Code Monkey home page Code Monkey logo

Comments (12)

danfenghong avatar danfenghong commented on June 30, 2024

from ieee_tnnls_egu-net.

Lee-Carl avatar Lee-Carl commented on June 30, 2024

也就是说,将通过优化的VCA生成的端元视为预测的端元,也就是这图上的红线部分的端元?
image

from ieee_tnnls_egu-net.

danfenghong avatar danfenghong commented on June 30, 2024

from ieee_tnnls_egu-net.

Lee-Carl avatar Lee-Carl commented on June 30, 2024

是这个优化问题吧?
image

from ieee_tnnls_egu-net.

danfenghong avatar danfenghong commented on June 30, 2024

from ieee_tnnls_egu-net.

Lee-Carl avatar Lee-Carl commented on June 30, 2024

是的。 Lee-Carl @.> 于2023年12月9日周六 11:46写道:

是这个优化问题吧? image.png (view on web) https://github.com/danfenghong/IEEE_TNNLS_EGU-Net/assets/118745813/9c10e320-e1c6-470d-bab2-dbf0a1555f64 — Reply to this email directly, view it on GitHub <#14 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFL2GZS4A362QZTMAPQ74Y3YIPNITAVCNFSM6AAAAABAC5V3GOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBYGIYDSNJZGM . You are receiving this because you commented.Message ID: @.
>
感谢您的回复!尝试了几个最优化方法后,已通过pytorch优化目标函数的方式得到了端元,指标计算也ok。第一次了解这种间接的提取端元的方式(之前都是通过解码器或是方法直接给出的)。再次感谢您的耐心回复!

from ieee_tnnls_egu-net.

atheeraa avatar atheeraa commented on June 30, 2024

@Lee-Carl

mizing the objective function with pytorch, and the indicator calculation is OK. This is the first time I understand this indirect way of extracting endmembers (previo

Would you mind sharing the code for extracting the endmembers?

from ieee_tnnls_egu-net.

danfenghong avatar danfenghong commented on June 30, 2024

from ieee_tnnls_egu-net.

Lee-Carl avatar Lee-Carl commented on June 30, 2024

@Lee-Carl

mizing the objective function with pytorch, and the indicator calculation is OK. This is the first time I understand this indirect way of extracting endmembers (previo

Would you mind sharing the code for extracting the endmembers?

OK. However, I saw that Prof Hong replied to you. I suggest you use his method. Currently, my code has only been tested on experiments I've done, not yet on the EGU-Net.Here is my code:

import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np


def extract_edm(y, a):
    """
    Args:
        y (numpy.ndarray): Mixed pixels (L, N).
        a (numpy.ndarray): Estimated abundances (P, N).

    Returns:
        E_solution (numpy.ndarray): Estimated endmembers (L, P).
    """
    # Check if GPU is available
    device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

    # Move data to GPU
    Y = torch.from_numpy(y.copy().astype(np.float32)).to(device)
    A = torch.from_numpy(a.copy().astype(np.float32)).to(device)

    # Initialize endmembers using Xavier initialization and move parameters to GPU
    E = nn.Parameter(torch.empty(Y.shape[0], A.shape[0]).to(device))
    nn.init.xavier_uniform_(E)

    # Define optimizer
    optimizer = torch.optim.Adam([E], lr=0.01)

    # Perform optimization
    for epoch in range(1000):
        optimizer.zero_grad()  # Clear gradients
        # Calculate the mean squared error loss as the objective function
        loss = F.mse_loss(Y, torch.matmul(E, A))
        loss.backward()  # Backpropagation
        optimizer.step()  # Update parameters
        E.data = torch.clamp(E.data, min=0)  # Force E to be non-negative

    # Get the final estimated endmembers
    E_solution = E.data.cpu().numpy()  # Move the result back to CPU

    return E_solution

from ieee_tnnls_egu-net.

atheeraa avatar atheeraa commented on June 30, 2024

The endmembers are extracted by VCA. The code also includes the endmember extraction. Atheer Abdullah @.> 于2023年12月10日周日 02:44写道:

mizing the objective function with pytorch, and the indicator calculation is OK. This is the first time I understand this indirect way of extracting endmembers (previo Would you mind sharing the code for extracting the endmembers? — Reply to this email directly, view it on GitHub <#14 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFL2GZRP4FKXRDJLP4BSOMTYISWSFAVCNFSM6AAAAABAC5V3GOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBYGYYTCNJUG4 . You are receiving this because you commented.Message ID: @.
>

Thank you for your reply, is it the EM or the sub_EM ?

I'm trying to compare your work with my thesis but there are some questions if your don't mind,

  1. In the paper you said HySime is used to obtain the number of endmembers, but when is that number used?
    In my work and other autoencoder based unmixing, the number of hidden units in the last layer of the encoder should reflect the number of endmembers, now in your architecture, what should I use? the number I got from HySime?

If so, it doesn't work, since the Trlabel uses the actual number of endmembers from M.

  1. If not, then what's the purpose of using HySime?

Would appreciate your replies.

from ieee_tnnls_egu-net.

atheeraa avatar atheeraa commented on June 30, 2024

@Lee-Carl

mizing the objective function with pytorch, and the indicator calculation is OK. This is the first time I understand this indirect way of extracting endmembers (previo

Would you mind sharing the code for extracting the endmembers?

OK. However, I saw that Prof Hong replied to you. I suggest you use his method. Currently, my code has only been tested on experiments I've done, not yet on the EGU-Net.Here is my code:

import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np


def extract_edm(y, a):
    """
    Args:
        y (numpy.ndarray): Mixed pixels (L, N).
        a (numpy.ndarray): Estimated abundances (P, N).

    Returns:
        E_solution (numpy.ndarray): Estimated endmembers (L, P).
    """
    # Check if GPU is available
    device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

    # Move data to GPU
    Y = torch.from_numpy(y.copy().astype(np.float32)).to(device)
    A = torch.from_numpy(a.copy().astype(np.float32)).to(device)

    # Initialize endmembers using Xavier initialization and move parameters to GPU
    E = nn.Parameter(torch.empty(Y.shape[0], A.shape[0]).to(device))
    nn.init.xavier_uniform_(E)

    # Define optimizer
    optimizer = torch.optim.Adam([E], lr=0.01)

    # Perform optimization
    for epoch in range(1000):
        optimizer.zero_grad()  # Clear gradients
        # Calculate the mean squared error loss as the objective function
        loss = F.mse_loss(Y, torch.matmul(E, A))
        loss.backward()  # Backpropagation
        optimizer.step()  # Update parameters
        E.data = torch.clamp(E.data, min=0)  # Force E to be non-negative

    # Get the final estimated endmembers
    E_solution = E.data.cpu().numpy()  # Move the result back to CPU

    return E_solution

Thank you very much!
Appreciate it.
May I ask what did you pass as the abundance a?
is it generated from Pseudo_endmembers_generation.m ?

from ieee_tnnls_egu-net.

Lee-Carl avatar Lee-Carl commented on June 30, 2024

@atheeraa No, the abundance a is from the results of unmixing methods.

from ieee_tnnls_egu-net.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.