Comments (7)
Kindly refer to Fig. 3 in the paper (https://arxiv.org/pdf/2103.01849.pdf). The attention is not in the channel dimension, but in the "resolution" dimension. There is only one query (the output), and one key/value for each resolution level.
In order to use it for your segmentation project, you're going to need to adapt data_loading.py
for your own dataset and then simply call python train.py
.
from hed-unet.
from hed-unet.
Thanks for your reply! I had met another question about how to visualize the effective receptive field like fig9 in the article. Can you show me the code? This can help me a lot. Thanks again!
from hed-unet.
The general idea is to backpropagate the output of a central pixel, and average that over your validation dataset:
erfs = []
for img, mask in val_loader:
img = img.to(device)
img.requires_grad = True
out = model(img)
_, _, H, W = out.shape
center = out[:, :, H//2, W//2].mean()
center.backward()
erfs.append(img.grad.abs().mean(dim=[1,2]))
erf = torch.mean(torch.stack(erfs, dim=0), dim=0)
Written from memory - I am not on the server to double-check the accuracy of the above code. Let me know if you have any additional questions.
from hed-unet.
Thanks for your reply! I got this idea and understood the idea of ERF after your teaching. I have another question about how to get the figure of edge like fig 5. In other words, how to detect the edge from the segmentation results? Can you show me the code?
from hed-unet.
The model directly generates an edge detection map, there is no need to derive the edges from the segmentation results. I.e. model(inputs)[batch_idx, 0]
will be the segmentation prediction and model(inputs)[batch_idx, 1]
is the edge prediction.
The function used for the plots in fig. 5 is literally the first function in train.py
:
Line 41 in 49f8d30
from hed-unet.
from hed-unet.
Related Issues (18)
- How could I get the complete images on result HOT 1
- Training steps HOT 4
- Is the image input during the training process the original image and the binary image? HOT 17
- Testing data HOT 7
- Whether this program can handle .png files. If you can’t handle it, can you convert the .tif file to a .png file? HOT 1
- AttributeError: 'Array' object has no attribute 'numpy' HOT 1
- RuntimeError: Given groups=1, weight of size [16, 3, 1, 1], expected input[8, 4, 256, 256] to have 3 channels, but got 4 channels instead HOT 10
- Hello, my training is successful, then I would like to ask how to test my own data? HOT 1
- About training HOT 21
- About Loss HOT 5
- About mutil classes HOT 19
- Weight Map HOT 2
- I have some questions about testing. HOT 6
- About the differences between predictions and queries. HOT 3
- Does the edge detection task have an impact on the semantic segmentation task in this model? HOT 1
- Can you please share the pre-trained weights for interence HOT 1
- Can the author provide code for prediction
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 hed-unet.