DepthwiseConvolution icon indicating copy to clipboard operation
DepthwiseConvolution copied to clipboard

Do you have implemented the "cpp" file of DepthwiseConvolution for CPU?

Open csyking opened this issue 7 years ago • 10 comments

You maybe only have implemented the layer for CUDA, but the implementation of CPU is still only the original "Caffe's conv+group"?

The same issue is here: https://github.com/Zehaos/MobileNet/issues/22

I wonder if you will implement the DepthwiseConvolutionLayer for CPU? Any contribution will be grateful!

Best.

csyking avatar Jun 29 '17 05:06 csyking

He already implement the cpu version,you can find that in code.

ONLY-VEDA avatar Jul 06 '17 12:07 ONLY-VEDA

But looks like cpu version does not optimized for depthwise conversion.

mychina75 avatar Jul 07 '17 03:07 mychina75

I'm sorry for uncertainty about this. It's a tough work and I am right busy on other work.

yonghenglh6 avatar Jul 07 '17 10:07 yonghenglh6

Hi @yonghenglh6
Can we use your cpp/hpp/cu files to load MobileNet you pasted as pretrained weight to do finetune work? I have this question is because when we update conv to depthwsie, caffe still can load the pretrained weight? Or caffe base on layer {name} to load the pretrained weight?

ryusaeba avatar Jul 10 '17 10:07 ryusaeba

I check the website http://caffe.berkeleyvision.org/gathered/examples/finetune_flickr_style.html and saw the following statement. "If we provide the weights argument to the caffe train command, the pretrained weights will be loaded into our model, matching layers by name." Therefore, I assume your answer is correct. If I am wrong, please correct me. Thanks!

ryusaeba avatar Jul 10 '17 10:07 ryusaeba

@ryusaeba Yes, that's why I use the original conv_param instead of new special param. You can just change the type without compatible price.

yonghenglh6 avatar Jul 11 '17 11:07 yonghenglh6

@yonghenglh6 Thanks! I have got all pass message by using check.py. Then I apply DepthWiseConvlution on https://github.com/shicai/MobileNet-Caffe inference path, the TOP-1 result (accuracy) is the same but I get slight difference on loss. I assume the loss will be the same. Do you have any idea about this?

ryusaeba avatar Jul 12 '17 05:07 ryusaeba

@ryusaeba
The slight difference comes from the blas algorithm. I did not employ the blas lib, while the original conv layer did. I assume the blas algorithm sacrifice slight precision to get better performance, because the depthwise outputs matches my handcraft computation.

yonghenglh6 avatar Jul 12 '17 06:07 yonghenglh6

hello ,do you implement the DepthwiseConvolutionLayer for CPU?

libra7 avatar Oct 26 '17 08:10 libra7

.....wait

sunjunlishi avatar Nov 17 '17 08:11 sunjunlishi