xwjabc / hed Goto Github PK
View Code? Open in Web Editor NEWA PyTorch reimplementation of Holistically-Nested Edge Detection
A PyTorch reimplementation of Holistically-Nested Edge Detection
Hello. I have tested this code and have got good results. Thank you for sharing.
However, as I apply this code to my TEM images and get edge lines, the output images have rather thick edge lines.
So, I need to post-process those outputs to use in my actual job.
I need your idea. How can I get thinner edge lines from this algorithm?
Hi I realized that you load pre-trained parameters of caffe.
I was wondering if using the pre-trained parameters of caffe is necessary because I want to try training with other datasets rather than BSD500 and I assume that if pre-trained parameters are used, my new datasets won't be able to give an effect.
Thank you :)
Thanks so much for your implementation! It's been really helpful for understanding HED. Could you add a license for the code? That would make it more clear what you allow others to do with your code.
The functions of load_pretrained_caffe and load_vgg16_caffe have some difference? I don't know which one I should use? Can you give me some suggests?
Hi,Following your code,I get the accuracy of the results ODS=0.786 OIS=0.804.It's inspiring.But AP = 0.797,which is far less than the official results(0.833).would you mind telling me your AP?Thanks
hello,Where I can download 5stage-vgg.py36pickle.I just can download 5stage-vgg.caffemodel from saining orignal caffe hed.
I find that the results of NMS are the concatenation of three images along the column, is that correct?
Hi!Thanks for sharing this code! When I run your evaluation code:
python hed.py --checkpoint ./data/hed_checkpoint.pt --output ./output-mypretrain --test
cd eval
(echo "data_dir = '../output-mypretrain/test'"; cat eval_edge.m)|matlab -nodisplay -nodesktop -nosplash
I got this result:
ODS=0.381 OIS=0.386 AP=0.176 R50=0.020 - HED
That's confusing.
Is there some bugs in evaluation code or some considerations?
Thanks a lot.
Thanks for your code!But I have a question, how to evaluate the result?I don't have any idea, thanks!
Thank you for your code!
However,my output/epoch-#-train have 7 gray graphs,and the training process can be carried out without error reporting,looking forward to your reply!
您好,我在运行下面语句时有一些问题
cd eval
(echo "data_dir = '../output-mypretrain/test'"; cat eval_edge.m)|matlab -nodisplay -nodesktop -nosplash
这个语句怎么用?我在运行时直接复制您的这条语句运行?还是需要自己先创建一些文件?
Traceback (most recent call last):
File "hed.py", line 309, in
main()
File "hed.py", line 189, in main
train(train_loader, net, opt, lr_schd, epoch, save_dir=join(output_dir, 'epoch-{}-train'.format(epoch)))
File "hed.py", line 214, in train
for batch_index, (images, edges) in enumerate(tqdm(train_loader)):
File "C:\Users\Administrator\anaconda3\envs\37\lib\site-packages\tqdm\std.py", line 1195, in iter
for obj in iterable:
File "C:\Users\Administrator\anaconda3\envs\37\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next
data = self._next_data()
File "C:\Users\Administrator\anaconda3\envs\37\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "C:\Users\Administrator\anaconda3\envs\37\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Users\Administrator\anaconda3\envs\37\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "F:\hed\datasets.py", line 43, in getitem
edge = edge[np.newaxis, :, :] # Add one channel at first (CHW).
TypeError: 'NoneType' object is not subscriptable
想请问在评测代码里面,是否对真值进行了二值化,以及在运行评测标准时,会计算人类的标准,大概score是0.8,这个是如何计算的?还有个问题是bsds500上面的原数据是由七个人标注,然后融合取平均,那在测试集上也是拿平均后的真值去评测的吗?
Hello,
I'm trying to use your evaluation code on MATLAB (r2019b) on mac os x but I get this error:
Error using edgesEvalImg (line 70) Invalid MEX-file '/Users/antoninsumner/Documents/GitHub/EdgeDetection_ModelsComparison/eval/edges/private2/correspondPixels.mexmaci64': dlopen(/Users/antoninsumner/Documents/GitHub/EdgeDetection_ModelsComparison/eval/edges/private2/correspondPixels.mexmaci64, 6): Library not loaded: @loader_path/libmex.dylib Referenced from: /Users/antoninsumner/Documents/GitHub/EdgeDetection_ModelsComparison/eval/edges/private2/correspondPixels.mexmaci64
Apparently this is due to the use of @loader_path/libmex.dylib
@loader_path seems to be depreciated and @rpath should be used instead.
https://stackoverflow.com/a/48473295/6752124
Do you think you can re-compile the correspondPixels.mexmaci64 file with @rpath or maybe provide the original MATLAB code?
Thank you
File "hed.py", line 302, in
main()
File "hed.py", line 156, in main
load_vgg16_caffe(net, args.vgg16_caffe)
File "D:\Application\Object_Detection\hed-master\utils.py", line 87, in load_vgg16_caffe
load_pretrained_caffe(net, path, only_vgg=True)
File "D:\Application\Object_Detection\hed-master\utils.py", line 94, in load_pretrained_caffe
pretrained_params = pickle.load(f)
_pickle.UnpicklingError: invalid load key, '\x0a'.
hi ! I try to trained the model on another dataset BIPED. However i met similar problems with issue 36 but not same. I already used the pretrained model. But for my trainning output, only the fifth and sixth output images are white. I don't know what is the problem and how to fix it.
Hi,
Nice repo. What is the reason for keeping padding=35 for the first convolutional layer?
I am not sure if the HED architecture advises that.
Thanks for this progect!
My compilation for Caffe or modified HED doesn't sussess. I noticed cafffemodel can be converted into pickle with some tools. But it still uses Caffe as Dependency.
Could you upload "hed_pretrained_bsds.py36pickle" file?
Thanks for your help.
What should the composition of the data set folder look like? What does the .lst file do? Beginners ask for advice
Thanks for sharing your code and it works well.
I have some doubts about the learning rate. Why learning rate for conv5 is 100x of base learning rate, and classification layer(dsns) is 0.01x of base learning rate? For fune-tuning, learning rate for classification layer(which is trained from scratch) is usually set 10x compared to the backbone network parameters, right?
Besides, if I insert new layers into hed, how should I set the learning rate for them?
When I train the model, the test result of image is gray and all the value in the mat is 0.5. Is there some error when I train the model with pycharm?
I have got the correct nms result. But it seems my ground-truth loading part hsas bug,but I don't know whats' the problem.my ground-truth edge is 255,and non-edge is 0,ist hat right?And the _ev1.txt is like this:
0.01 5411 7637.75 5411 5464
0.02 5411 7637.75 5411 5464
0.03 5411 7637.75 5411 5464
0.04 5411 7637.75 5411 5464
0.05 5411 7637.75 5411 5464
0.06 5411 7637.75 5411 5464
0.07 5409 7637.75 5409 5462
0.08 5409 7637.75 5409 5462
0.09 5409 7637.75 5409 5462
0.1 5409 7637.75 5409 5462
0.11 5409 7637.75 5409 5462
0.12 5409 7637.75 5409 5462
0.13 5402 7637.75 5402 5455
0.14 5402 7637.75 5402 5455
0.15 5402 7637.75 5402 5455
0.16 5402 7637.75 5402 5455
0.17 5402 7637.75 5402 5455
0.18 5402 7637.75 5402 5455
0.19 5400 7637.75 5400 5452
0.2 5400 7637.75 5400 5452
0.21 5400 7637.75 5400 5452
And the AP is very small and the P-R curve is not correct.
Hi, The code to compute evaluation metric is matlab-based in your repo.
Do you have any evaluate code in python? I want to compute the metric in training process.
Hello, could you tell me how to generate the ground-truth edge image? I want to evaluate hed on my own dataset.
For the open BSDS dataset, the ground-truth is described by .mat file.
Hi @xwjabc
Thanks for your contribution, I have a question just in the line below:
else:
# Zero initialization following official repository.
# Reference: hed/docs/tutorial/layers.md
m.weight.data.zero_()
I see that you have used tensorflow too, so this weight initializer is something like
tf.truncated_normal_initializer(mean=0.) or tf.constant_initializer(0.0)
Thanks in advance
xavysp
Line 100 in c8ed5ab
I also find this config in the original repo. I think it may be used to increase side outputs resolution, but why it's 35?
Thank you for this elegent project ! I am trying to train a HED model using my own dataset. All the hyper-parameters are followed by this project and the results is also reasonable. However, the fifth side outputs of all the test image (shown below) are almost gray, which confuses me greatly. Could you have some ideas about this scenario?
I reimplement the python based eval code. Only Python, Not Matlab.
https://github.com/Walstruzz/edge_eval_python
Thank you for sharing your implementation.
I am wondering would be useful to use the HED network for the binary edge detection for the custom dataset?
Here is an example of my image and its ground truth:
Thank you in advance
In the datasets.py file, the original code is like this:
image = image - np.array((104.00698793, # Minus statistics.
116.66876762,
122.67891434))
but How can i get the new statistics number for my own dataset?
Thanks for your great work and kind sharing.
Have you ever test your model on NYU depth dataset? I came up against a problem in this step.
I could not find the NYUD edge ground truth file after training on its training sets, could you please give me any advice?
Thanks in advance.
Thanks for your good jobs and nice sharing.
I just wonder how can I use the pretrained model by Pytorch instead of caffe.
Is there any existing job?
Thanks again.
Hello, I reproduced the code according to your steps, but the training results are ODS: 0.755, OIS: 0.773, AP: 0.650, which is different from your results. What's the problem?
Thank you for your contribution about the HED in pytorch. About the aligned crop, I'd like to ask you some questions, why did not you use the offset which got by (offset = (Original_length - desired length ) / 2) to crop the image?
Sorry to write here about DeepFashion2 I was seeing your comments on DeepFashion2 you have trained model. Can you guide how to train DeepFashion2 I tried it but it was confusing.
If there is no weight of VGG16, the network does not seem to be able to train the results. Why? If I do not use the pre-trained weight file, how should I get an ideal result? Does the blogger have suggestions or have they implemented it?
Thanks for your code and the model I trained is quite good(ODS=0.788.OIS=0.806)。 I just have a question when i see the log during the training,the epoch average batch_loss maintains at around 1700 after 5th epoch ,until the end. Does this mean that the model does not converge?
I have a question. The training loss of the HED network is relatively large, thousands or even higher, but the result is not bad. Why is the loss of the HED relatively large? Under normal circumstances, loss should be a very small value.
When we evaluate the result,we need to run the EdgeEvalDir.m,but what's the meaning of maxDist. I am confused about it and there isn't code.Can you explian it or give some papers to explain it?
Thanks a lot!
Hello, thanks for sharing! I want to get the five side-outputs however Pytorch is different to caffe. Is
there any suggestions? Thanks a lot! Looking forward to your reply!
Hi, Thanks for your sharing! Could you tell me why to use 'prepare_aligned_crop' function in building network. I do not understand.
Hi @xwjabc,
Thanks for your code!
Could you please tell me if it is possible to have a higher batch-size (>1) for training? I see that when I try this out, I get the following error -
upsample2 = torch.nn.functional.conv_transpose2d(score_dsn2, self.weight_deconv2, stride=2)
Expected tensor for argument #1 'input' to have the same device as tensor for argument #2 'weight'
Just wondering if you know this already.
Thanks,
AA
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.