Giter Club home page Giter Club logo

hed's Introduction

Reimplementation of HED based on official version of caffe

For training:

  1. Clone this code by git clone https://github.com/zeakey/hed --recursive, assume your source code directory is$HED;

  2. Download training data from the original repo, and extract it to $HED/data/;

  3. Build caffe with bash $HED/build.sh, this will copy reimplemented loss layer to caffe folder first;

  4. Download initial model and put it into $HED/model/;

  5. Generate network prototxts by python model/hed.py;

  6. Start to train with cd $HED && python train.py --gpu GPU-ID 2>&1 | tee hed.log.

For testing:

  1. Download pretrained model $HED/snapshot/;

  2. Generate testing network prototxt by python $HED/model/hed.py(will generate training network prototxt as well);

  3. Run cd $HED && python forward_all();

Performance evaluation

I achieved ODS=0.779 on BSDS500 dataset, which is similar to HED's 0.78. Your can train your own model and evaluate using this code.

Pretrained models and detection results:

Orig-HED My-HED
Pretrained model Pretrained model
BSDS results BSDS results
Evaluation results Evaluation results

All detection results on the BSDS500 testing set and the pretrained models are provided. For example, the detected results of '3063.jpg' by the original HED and my implementation are shown below:

http://data.kaiz.xyz/edges/detection_results/hed_pretrained_bsds/3063.png

http://data.kaiz.xyz/edges/detection_results/my_hed_bsds/3063.png

You can preview results of all other images by replacing the filename in the above url.


By KAI ZHAO

hed's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hed's Issues

error == cudaSuccess (2 vs. 0) out of memory on net.forward()

Hi,

I'm facing this issue when trying to run inference on latest caffe version:

syncedmem.cpp:71] Check failed: error == cudaSuccess (2 vs. 0) out of memory
*** Check failure stack trace: ***
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

It works for me on HED customized version (https://github.com/s9xie/hed).

I'm using Cuda 9.0. Any ideas?

Thanks,
Ricardo

The label must be converted to [0,1]?

if (target[i] == 1) {
  loss_pos -= input_data[i] * (target[i] - (input_data[i] >= 0)) -
      log(1 + exp(input_data[i] - 2 * input_data[i] * (input_data[i] >= 0)));
  count_[1]++;
} else if (target[i] == 0) {
  loss_neg -= input_data[i] * (target[i] - (input_data[i] >= 0)) -
      log(1 + exp(input_data[i] - 2 * input_data[i] * (input_data[i] >= 0)));
  count_[0]++;
} else {
  LOG(FATAL)<<"Unknown target value: " << target[i];
}

build.sh is missing

Thanks a lot for this implementation.

I want to use this repository to train a HED model. However, it does not seem to have the shell script build.sh to copy loss layer and build caffe. Am I missing something?

If not, could you please add the file to the repository?

when i want to download the pretrained model it told me 403 forbidden

the address is data.kaiz.xyz/edges/my_hed_pretrained_bsds.caffemodel
403 Forbidden

Code: AccessDenied
Message: Access Denied
RequestId: 088A3B04BDB1BF5E
HostId: 2pp+AnL3hyJvPcFdTeL3Wp845kqKlM1KrfUhI3hA81VhsFg80ehIdEuInWQVf9jzPJMqXeUzOaU=

An Error Occurred While Attempting to Retrieve a Custom Error Document

Code: AccessDenied
Message: Access Denied

rcf's ODS

Thanks for sharing your work.
I saw that you had implemented the rcf net, what is the ODS of this implemention?
Look forward to your!

Files in readme are not longer available

Hi @zeakey, seems like the s3 bucket where the file are allocated is not longer available for download. Can you re-upload again?, or send me the files to [email protected], I'll happy to help uploading the files again to a s3 bucket and restore the links.

I'm trying to understand how it works and the files are important in the process.

The uploading files in the readme are:

  • The initial model
  • The pretrained model
  • Original pretrained model, bsds results and evaluation results
  • My Hed pretrained model, bsds results and evaluation results
  • The original result image 3063.png
  • The my hed result image 3063.png

warning in build.sh

Hello, another question came out,
When I sudo bash bulid.sh there is a warning src/caffe/layers/balance_cross_entropy_loss_layer.cu(45): warning: statement is unreachable
After that, I run python train.py an mistake throw out.
Check failed: registry.count(type) == 1 (0 vs. 1) Unknown layer type: BalanceCrossEntropyLoss (known types: AbsVal, Accuracy, ArgMax, BNLL, BatchNorm, BatchReindex, Bias, Concat, ContrastiveLoss, Convolution, Crop, Data, Deconvolution, Dropout, DummyData, ELU, Eltwise, Embed, EuclideanLoss, Exp, Filter, Flatten, HDF5Data, HDF5Output, HingeLoss, Im2col, ImageData, InfogainLoss, InnerProduct, Input, LRN, LSTM, LSTMUnit, Log, MVN, MemoryData, MultinomialLogisticLoss, PReLU, Parameter, Pooling, Power, Python, RNN, ReLU, Reduction, Reshape, SPP, Scale, Sigmoid, SigmoidCrossEntropyLoss, Silence, Slice, Softmax, SoftmaxWithLoss, Split, Swish, TanH, Threshold, Tile, WindowData)
Can you help me?

Failed in train.py

Hi , i got a error in the train.

F0731 17:12:15.323357 32193 cudnn.hpp:128] Check failed: status == CUDNN_STATUS_SUCCESS (3 vs. 0) CUDNN_STATUS_BAD_PARAM

Could you please tell me how to solve it? Mann thanks

CUDA, cuDNN and Matlab version

Hi! Could you specify the Cuda version and Matlab version you are using? Does this matcaffe supports cuDNN? I am having trouble with the original version of hed. I appreciate your reimplement of it on the later version of cuda driver!

error in testing

First and second steps are successful.

error in the third

zhoukuai@zhoukuai-B360M-D3V:/下载/hed-master$ python forward_all()
bash: 未预期的符号 (' 附近有语法错误 zhoukuai@zhoukuai-B360M-D3V:~/下载/hed-master$ python forward_all.py() bash: 未预期的符号 (' 附近有语法错误
zhoukuai@zhoukuai-B360M-D3V:
/下载/hed-master$ python forward_all.py
Traceback (most recent call last):
File "forward_all.py", line 25, in
assert isfile(args.model) and isfile(args.net), 'file not exists'
AssertionError: file not exists

Caffe comoilation error

tools/CMakeFiles/caffe.bin.dir/build.make:136: recipe for target 'tools/caffe' failed
make[2]: *** [tools/caffe] Error 1
CMakeFiles/Makefile2:489: recipe for target 'tools/CMakeFiles/caffe.bin.dir/all' failed
make[1]: *** [tools/CMakeFiles/caffe.bin.dir/all] Error 2

hello,can you help me?

作者你好,我是上海大學的學生,我用的您的代碼對自己的圖片進行訓練,然後我用的cpu的caffe不是gpu版本的,然後出現了以下的問題,請問您能給我i點幫助嗎?謝謝

File "train.py", line 25, in
solver.solve()
File "lib/pylayer.py", line 41, in forward
[imgfn, lbfn] = self.filelist[self.idx].split()
ValueError: need more than 0 values to unpack

Failed in output.

I tried forward.py. The output is right and i got an edge image.
Bye I tried in torch with lua as following
local edge_net =caffe.Net('hed_test.pt', 'my_hed_pretrained_bsds.caffemodel', 'test')
local test=image.load('97010.jpg',3):float()
local test=test:resize(1,3, 500, 500)
local output = edge_net:forward(test)
local output2=output[1]
image.save('abc.jpg', output2 / output2:max())

The output is wrong.

abc

Could you please tell me why?

Many thanks

Link damage

@zeakey
Have the Initial model and Pretrained model on the project been damaged?

Error running models/hed.py

python model/hed.py
Traceback (most recent call last):
File "model/hed.py", line 3, in
import caffe
File "caffe/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
File "caffe/python/caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
ImportError: dynamic module does not define module export function (PyInit__caffe)

build.sh has been run and built .so successfully

Out of video memory

My GT1030 has 2GB memory, Stop after a few seconds and told me out of memory. I want to know how to lower the batch_size of the train process. I have found how to lower the iter_size and reduce it to 1, even so it tells me out of memory.

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.