sniklaus / pytorch-hed Goto Github PK
View Code? Open in Web Editor NEWa reimplementation of Holistically-Nested Edge Detection in PyTorch
License: GNU General Public License v3.0
a reimplementation of Holistically-Nested Edge Detection in PyTorch
License: GNU General Public License v3.0
Traceback (most recent call last):
File "run.py", line 152, in
tenOutput = estimate(tenInput)
File "run.py", line 135, in estimate
netNetwork = Network().eval()
File "run.py", line 95, in init
self.load_state_dict({ strKey.replace('module', 'net'): tenWeight for strKey, tenWeight in torch.hub.load_state_dict_from_url(url='http://content.sniklaus.com/github/pytorch-hed/network-' + arguments_strModel + '.pytorch', file_name='hed-' + arguments_strModel).items() })
TypeError: load_state_dict_from_url() got an unexpected keyword argument 'file_name'
Hello! Thanks for your work on re-implement HED from image to image. It's a practical Project! Can you teach me how to get HED side-output(eg. side-output 4)? HED's output is a fuse output ,I want to compare side-output with fuse output.
Is there a way to run this on CPU?
Hi,
Really appreciate your re-implement, do you have any suggestions for obtaining slimmer edges.
Thank you
Best
Hi there, it seemed that your latest commit(5ef88c3) didn't work well with PyTorch 1.6? After python run.py
, I got the following error,
Traceback (most recent call last):
File "run.py", line 154, in
PIL.Image.fromarray((tenOutput.clip(0.0, 1.0).numpy().transpose(1, 2, 0)[:, :, 0] * 255.0).astype(numpy.uint8)).save(arguments_strOut)
AttributeError: 'Tensor' object has no attribute 'clip'
When I changed the clip
back to clamp
, it worked. Could you be so kind to provide me with any clues on this? Thanks.
Hi, I noticed that in the forward function it normalizes the input as
tenBlue = (tenInput[:, 0:1, :, :] * 255.0) - 104.00698793
tenGreen = (tenInput[:, 1:2, :, :] * 255.0) - 116.66876762
tenRed = (tenInput[:, 2:3, :, :] * 255.0) - 122.67891434
But when I noramlized it by ImageNet RGB mean[0.485, 0.456, 0.406] as follows:
tenBlue = tenInput[:, 0:1, :, :] - 0.406
tenGreen = tenInput[:, 1:2, :, :] - 0.456
tenRed = tenInput[:, 2:3, :, :] - 0.485
The output become blurry:
I feel very confused about this cause it seems to be same normalization process
can you tell me how to open network-bsds500.pytorch(i.e.the file download use download.bash), i use .txt or .py the file will change to garbled。so,can you provide .pth file,or tell me how to open it?
Hi, thank for your work! When I apply the network to some images, I found that the output is not fine-grained enough due to style gap and low resolution of source image. So how can I generate edge image with more detail? Change some hyperparameters?
I have read some source code about many edge detection network, all of the network are without BN layer, why was that?
Hi sniklaus,
Thanks very much for u excellent implementation.
There is a qusetion that I'd like to ask you for advice.
Have you ever used HED's feature map as a supervised term, just similar to VGG loss?
It would be greatly appreciated if you could offer me any suggestions!
Best,
Melon
Hey,
I just wanted to run your re-implementation of the pytorch HED model and the weights url http://content.sniklaus.com/github/pytorch-hed/network-bsds500 seems to point nowhere.
Keep up the good work!
Hello!
I really liked the idea of finding the edges of images with Holistically-Nested Edge Detection. But unfortunately, even on the sample.png image example, when I launch code "run.py" I have an error "option -f not recognized". I don't know how to solve this problem.
I also try to use reimplementation Pytorch Holistically-Nested Edge Detection with sample.png image example, I don’t get the same result as in the description, after running the code I get an image in gray shades and unlike contours.
I will be grateful for the answer!
thank you for sharing. How to test my own images with 512X512 size using your pretrained model?
Hello, I found you deleted the bash
file. Can you share the pretrained model?
It shows error on my laptop:
AssertionError: Torch not compiled with CUDA enabled
Is it possible to run without CUDA?
Hello, @sniklaus Thanks for your contribution! Is there a way to generate edges from multiple images under a specific directory with your run.py? It seemed that your run.py can only process a single image as input so far. Thanks.
Could you please provide the details of training your pytorch model? Thanks!
你好,我还没有运行原代码,我想看一下这个模型的效果。
你能不能分享一下bsds500 的模型,感激不尽。
`Hello,
I took images from the BSDS dataset, and individually analyzed the F-Scores. I observed that the result is pretty bad in general, and I am not sure what I'm doing wrong. I am suspecting a bug, but I'm not confident.
And of course, if the value of an individual cell is greater than 0.5, I round it off to 1 before estimating the F1 score. The image after rounding off looks like this:
Then, I calculate the F-Score using the following code:
Here, the gt
is the groundtruth and the pred
array is the prediction image from HED.
tp = np.sum(pred[np.where(pred == 1)] == gt[np.where(pred == 1)])
fp = np.sum(pred[np.where(pred == 1)] != gt[np.where(pred == 1)])
precision = tp / (tp + fp)
# recall
fn = np.sum(pred[np.where(pred == 0)] != gt[np.where(pred == 0)])
recall = tp / (tp + fn)
# f-value
fvalue = 2 * precision * recall / (precision + recall)
I get a value (F1 score) of 0.1 to 0.2.
The paper and the Github descriptions state much higher values (>0.7). Can anyone guide me regarding what could be going wrong? Since I am using the same metric and the same score, it is a little tricky.
Any help is appreciated.
I want to know if this code is used for training or testing? If it is for training, why would the result be directly output?
Traceback (most recent call last): File "run.py", line 153, in <module> tenOutput = estimate(tenInput) File "run.py", line 145, in estimate return netNetwork(tenInput.cuda().view(1, 3, intHeight, intWidth))[0, :, :, :].cpu() RuntimeError: shape '[1, 3, 320, 480]' is invalid for input of size 614400
I tried to test my own image, but I got this error. The difference between sample.png and my own image.png is the bit depth. Mine is 32 bit depth.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.