shicai / mobilenet-caffe Goto Github PK
View Code? Open in Web Editor NEWCaffe Implementation of Google's MobileNets (v1 and v2)
License: BSD 3-Clause "New" or "Revised" License
Caffe Implementation of Google's MobileNets (v1 and v2)
License: BSD 3-Clause "New" or "Revised" License
Seems that your label file is different from the inception-v3 model, could you please upload the label file?
Have you written a custom convolutional layer or using the existing layer with minor changes? Please help.
Hi there,
I would like to do detection. If I use your caffemodel as initial weight as my base network.
It is better to add your transform parameters (as below shows) in my .prototxt, right?
| # transform_param {
| # scale: 0.017
| # mean_value: [103.94,116.78,123.68]
So your input data range is changed from [0-255] to [0-4.335]. My understanding is correct?
Hi @shicai ,
I tried your depoly prototxt, yet didn't get a good acc result.
I'd be appreciated if you could share your solver prototxt for me to check.
thanks!
Now I want to convert the caffe model into Mxnet format. I want to know which version of caffe you used to obtain the mobilenet. Thank you!
Hi, I used your model to finetune my training data, and it worked well! But I noticed that the the forward processing time is 3 times larger than caffe alexnet(0.09s vs 0.03s).
The paper says this model has less computation than alexnet, but why the processing time is larger?
hello,
if i has a mobilenet karas model~how can i convert to caffe model?
Hi,
The caffemodel URL refers to the google doc which isn't a static url, so can I get a link to some static URL so that I can use it for our benchmarking purposes.
Thanks,
Surabhi
i try to use mobileNet caffemodel and prototxt in caffe classification with a cat image ,this image is in examples\images, i can not understand the answer
mobileNet
10.9953 - "n02948072 candle, taper, wax light"
10.6561 - "n06874185 traffic light, traffic signal, stoplight"
9.6233 - "n04591713 wine bottle"
9.1139 - "n04286575 spotlight, spot"
9.0703 - "n04356056 sunglasses, dark glasses, shades"
where am i wrong, i just replace the model file and trained file in caffe
how to change the two super-parameters ? Did anyone try it? @shicai
Hi, thanks a lot for your code. When I train, I get below errors, can you help me?
I0523 14:43:05.335593 4100 net.cpp:226] conv1/bn needs backward computation.
I0523 14:43:05.335593 4100 net.cpp:226] conv1 needs backward computation.
I0523 14:43:05.335593 4100 net.cpp:228] label_data_1_split does not need backwa
rd computation.
I0523 14:43:05.335593 4100 net.cpp:228] data does not need backward computation
.
I0523 14:43:05.335593 4100 net.cpp:270] This network produces output center_los
s_finetune
I0523 14:43:05.335593 4100 net.cpp:270] This network produces output softmax_lo
ss
I0523 14:43:05.335593 4100 net.cpp:283] Network initialization done.
I0523 14:43:05.335593 4100 solver.cpp:60] Solver scaffolding done.
I0523 14:43:05.335593 4100 caffe.cpp:252] Starting Optimization
I0523 14:43:05.335593 4100 solver.cpp:279] Solving FaceVggSoftmaxNet
I0523 14:43:05.335593 4100 solver.cpp:280] Learning Rate Policy: multistep
I0523 14:43:05.507194 4100 solver.cpp:337] Iteration 0, Testing net (#0)
I0523 14:46:06.717113 4100 solver.cpp:404] Test net output #0: center_loss_
finetune = 95.8247 (* 0.001 = 0.0958247 loss)
I0523 14:46:06.717113 4100 solver.cpp:404] Test net output #1: softmax_loss
= 12.702 (* 1 = 12.702 loss)
I0523 14:47:12.206027 4100 solver.cpp:228] Iteration 0, loss = 12.4081
I0523 14:47:12.206027 4100 solver.cpp:244] Train net output #0: center_loss
_finetune = 99.0989 (* 0.001 = 0.0990989 loss)
I0523 14:47:12.206027 4100 solver.cpp:244] Train net output #1: softmax_los
s = 12.309 (* 1 = 12.309 loss)
I0523 14:47:12.221627 4100 sgd_solver.cpp:106] Iteration 0, lr = 0.1
F0523 14:47:39.974076 4100 math_functions.cu:26] Check failed: status == CUBLAS
_STATUS_SUCCESS (13 vs. 0) CUBLAS_STATUS_EXECUTION_FAILED
*** Check failure stack trace: ***
There is no problem run on CPU, but when run on GPU, it shows below error.
error_code=401; error_message=Network creation has failed. Layer conv2_1/dw.conv2_1/dw/bn.conv2_1/dw/scale: input depth must be divisible by 4 * number of groups; error_component=Dl Network; line_no=116; thread_id=-220678860
it train the imagenet about ten thousand epoch during one day.I use the caffe engine,because when I use the cudnn engine ,it occors error.
Hi, shicai
I want to use 'caffe time' evaluate network computing time. But encountered the same problem on different GPU.
Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNAL_ERROR.
Do you know how to solve this problem, and have you evaluated the network performance on different GPU?
Thank you!
I have run the mobilenet.caffemodel deploy.prototxt with SSD caffe to detect image but no output .
I use the classfy.py which caffe build-in,but I get the same result with different test pictures each time,Is anywhere wrong?the same to mobilenet's model.I find that the common thing in shufflenet and mobilenet,their last layer's type is convolution,I'd like to konw how to test this kind of models?thank you.
Check failed: target_blobs.size() == source_layer.blobs_size() (5 vs. 3) Incompatible number of blobs for layer conv1/bn, this error indicates that i have different blobs in the conv1/bn layer, any idea why this happens?
255*0.017 = 4.335, why?
Thanks!
Hi @shicai
could you explain the need/purpose of the Scale layer after every BatchNorm?
Thanks a lot!
Best, Christoph
Hi,as vpn service is shutdown,we can hardly access google.So can you share the pretrained caffemodel with us through pan.baidu.com or others?
@shicai thanks for your work. I have two Qs:
tensorflow-mobilenet has four alpha value,(1, 0.75, 0.5, 0.25)
https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet_v1.md
what is the alpha value of the pretained caffe-mobilenet?
Thanks!
Hi @shicai and thanks for porting this to Caffe!
I'm using this code https://github.com/BVLC/caffe/blob/master/examples/00-classification.ipynb for testing the model but get odd results. The closest I can get to an acceptable result is by commenting these lines:
#transformer.set_mean('data', (mu)) # subtract the dataset-mean value in each channel
#transformer.set_raw_scale('data', 255) # rescale from [0, 1] to [0, 255]
I suppose it is something related to scale: 0.017 but I cannot figure out what to change.
How should the input be transformed in order to get good results? Thanks.
Could you share the training details? something like lr_step, wd and data aug?
when train on Maxwell GeForce GTX TITAN X , there was an error( [math_functions.cu:79] Check failed: error == cudaSuccess (74 vs. 0) misaligned address) , I change cuda7.5 to cuda8.0 and cudnn to cudnn5.1 but it was not work. Then I change the convolution engine to CAFFE, it worked but the training speed was too slow. How to fix the problem, thx.
I used your prototxt to train on dataset cifar10. I thought it must be very fast. But On P40 GPU, 32*32 input, 50 batchsize, it's 5+ second one batch.
So, Something wrong happend when the model is only 13M?
Thx for your work. I am reproducing your model with inception-style crop-scale and color augmentation as you claimed in #1 . Here I wonder what's your training time for each iteration with batchsize 256. With these data augmentation tricks my training time is ~18s for each 10 iterations, which is much slower than just random crop (4s).
according to baidu or google :to set batchsize low,but the batch size of faster rcnn is 1,which cannot change, and if i chnange the size of input image,this question will happen:
valueerror:attemot to get argmax of an empty sequence.
do you have any advice to solve it?
thanks
@shicai I found mobilenet_v2_deploy.prototxt is encoded as utf8-bom. This leads to some running and conversion problems
When I try to run the following :
python eval_image.py --proto mobilenet_deploy.prototxt --model mobilenet.caffemodel --image ./cat.jpg
I get the following error:
WARNING: Logging before InitGoogleLogging() is written to STDERR W0207 13:16:05.342907 19952 _caffe.cpp:139] DEPRECATION WARNING - deprecated use of Python interface W0207 13:16:05.342963 19952 _caffe.cpp:140] Use this instead (with the named "weights" parameter): W0207 13:16:05.342973 19952 _caffe.cpp:142] Net('mobilenet_deploy.prototxt', 1, weights='mobilenet.caffemodel') [libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.NetParameter: 1:1: Expected identifier. F0207 13:16:05.344348 19952 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: mobilenet_deploy.prototxt *** Check failure stack trace: *** Aborted (core dumped)
Any idea why this is caused?
Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNAL_ERROR
when I read readme.md I don not know how to do
Hi. when I train fast rcnn with the MobileNet, I have found that the traning time is very long.
It takes 90sec every 20 iteration while the ResNet only takes 17sec.
Is it normal?
how to speed up?
my gpu is gtx1080
Hi, thanks for sharing this MobileNets!
I am just wandering if I can reproduce same results on Caffe from scatch. Is it possible if you can sharing the solver.prototxt you used to achieve this accuracy rate? And how many days did it take to complete training?
Thanks~
Did someone meet the problem ,called error == cudaSuccess (77 vs. 0 ) , when I changed the original convolution to the format of the depthwise convolution,and run it , I got the math_functions.cuL79 ] check failed: error == cudaSuccess (77 vs. 0 ) an illegal memory access was encountered. However, when I used the CAFFE TIME to test the same prototxt(the depthwise convolution prototxt), it worked and cumulated the network's time.
I tried but only reach 0.63 top-1. Have you shuffled your data for each epoch?
609 01:12:10.964810 19888 caffe.cpp:300] Batch 998, accuracy = 0.66
I0609 01:12:10.964838 19888 caffe.cpp:300] Batch 998, accuracy_top5 = 0.84
I0609 01:12:10.964844 19888 caffe.cpp:300] Batch 998, loss = 1.49327
I0609 01:12:11.079627 19888 caffe.cpp:300] Batch 999, accuracy = 0.56
I0609 01:12:11.079668 19888 caffe.cpp:300] Batch 999, accuracy_top5 = 0.82
I0609 01:12:11.079674 19888 caffe.cpp:300] Batch 999, loss = 1.9213
I0609 01:12:11.079679 19888 caffe.cpp:305] Loss: 1.53589
I0609 01:12:11.079704 19888 caffe.cpp:317] accuracy = 0.633339
I0609 01:12:11.079715 19888 caffe.cpp:317] accuracy_top5 = 0.852882
I0609 01:12:11.079725 19888 caffe.cpp:317] loss = 1.53589 (* 1 = 1.53589 loss)
-Andy
i trained the model on flowers 102 with input size 224 and batch size 50. the graphics is k40 with 12g memory. it's out of memory. What's the problem?
When I want to use your prototxtfile for training, I get this error
I have the latest version of caffe, cudnn v5.1 and cuda 8 installed!
What is the cause for this and how can I get over it ?
Thanks in advance
@shicai Have you ever try to implement MobileNet with SSD? Thanks:)
Hi,
I hope to reproduce your training results. So could you share your training details?
Regards
I'm using NVIDIA DIGITS for object detection and I want to use your MobileNet model as the inner model.
But when I load the weights from the caffe model I get the following error:
Check failed: target_blobs.size() == source_layer.blobs_size() (5 vs. 3) Incompatible number of blobs for layer conv1/bn
I get similar errors in every batchnorm layer.
Which Caffe model did you use?
Hi!
when i run the net,i meet this issue:
Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNAL_ERROR
***./experimrnts/scripts/faster_rcnn_end2end.sh:line 57 :14240 Aborted
can you help me?thanks!
Hi all,
i just used a simple command running the classification.exe tool that comes with caffe windows prebuilt binaries...
i used an image of tabby the cat
https://devblogs.nvidia.com/wp-content/uploads/2016/07/cute.jpg
, the mean and labels from imagenet and
mobileNet-caffe prototxt and model file like this:
classification mobilenet_deploy.prototxt.txt mobilenet.caffemodel imagenet_mean.binaryproto labels.txt cute.jpg
---------- Prediction for cat.jpg ----------
10.9953 - "n02948072 candle, taper, wax light"
10.6561 - "n06874185 traffic light, traffic signal, stoplight"
9.6234 - "n04591713 wine bottle"
9.1139 - "n04286575 spotlight, spot"
9.0703 - "n04356056 sunglasses, dark glasses, shades"
now, even if i change the image, the results are allways the same...
what am i missing??
thank you..
Hello, Could you please provide the train_val.prototxt file?
I would like to do some fine-tuning but it seems like the number of blobs for the batchnorm layers are not the same between the training and deploy models.
for mobilenet _v2, stride=1 for conv4_7 in paper
The pretrained model works fine but the output layer values (confidence levels, probabilities) seem to be between about -10 and +25, with a typical top-1 result having value of 10...15.
This is of course enough to determine the correct label from the highest value, but what is the absolute maximum range of the output layer's values?
E.g. if I want to output confidence level in percentage how do I scale the output?
Can you share the train prototxt? I try to finetune your model, my implement always hard to converge.
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.