Comments (12)
from ieee_tnnls_egu-net.
也就是说,将通过优化的VCA生成的端元视为预测的端元,也就是这图上的红线部分的端元?
from ieee_tnnls_egu-net.
from ieee_tnnls_egu-net.
from ieee_tnnls_egu-net.
from ieee_tnnls_egu-net.
是的。 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.
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.
from ieee_tnnls_egu-net.
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.
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,
- 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.
- If not, then what's the purpose of using HySime?
Would appreciate your replies.
from ieee_tnnls_egu-net.
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.
@atheeraa No, the abundance a is from the results of unmixing methods.
from ieee_tnnls_egu-net.
Related Issues (13)
- Pure和Mixed数据的作用? HOT 1
- Larger areas HOT 1
- Psedo True Abundance Map Generation HOT 4
- 仿真数据集运行结果 HOT 2
- 关于近似纯像元及其丰度的构造 HOT 2
- 关于代码中的Trlabel以及Telabel HOT 7
- How to test on my data? HOT 2
- How to get Trlabel? HOT 1
- 在此代码上怎样测试Jasper ridge数据集 HOT 1
- 您好,我在代码上测试Jasper ridge数据集,但是结果出入很大,想请教几个问题 HOT 6
- 没有定义forward_propagation函数 HOT 2
- How to adjust the code for other datasets HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ieee_tnnls_egu-net.