xingwangsfu / caffe-yolo Goto Github PK
View Code? Open in Web Editor NEWYOLO (Real-Time Object Detection) in caffe
YOLO (Real-Time Object Detection) in caffe
Thanks for sharing your code. But I notice that all the convolution layers with batch normalization are set bias_term: false
in prototxt. I'm confused and I failed to find this part in author's paper nor in his code.
I would appreciate it if you tell me where you find this part. Thank you again!
Hello @xingwangsfu -- thank you for sharing your project.
Despite trying everything I can think of, I can't get the model architecture described by the prototxt files included in this project to learn. I have tried all of the included prototxt files with a variety of learning rates, batch sizes, etc., and with a known two-class dataset, and to no avail.
Can you recommend any changes I can try to get the included prototxt architectures to learn in caffe?
Thank you in advance.
Hi, when i am trying to run code, i got this error.
I0206 19:07:41.957289 4240 db_lmdb.cpp:35] Opened lmdb ../../data/yolo/lmdb/trainval_lmdb
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
*** Aborted at 1486375661 (unix time) try "date -d @1486375" if you are using GNU date ***
PC: @ 0x7fcc79408428 gsignal
*** SIGABRT (@0x3e800001088) received by PID 4232 (TID 0x7fcc4b6f0700) from PID 4232; stack trace: ***
i think the dataset is the problem.
Please tell me what is wrong
Hi, xingwang,
I'm a green hand to caffe. I wonder how to convert the darknet's weights to caffe's? Thanks.
I can't find "result" layer in "yolo_train_val.prototxt". And I don't know how to prepare lmdb for caffe-yolo :)
Hey,
thank you
How to fine tune your model?
I don't have sufficient data to retrain your model from scratch.
I want to fine tune your model on my data which has only two classes ?
hi,Thank you very much for your work.But I can't download the" .cfg files ",Can you help?
Hi, thanks for the cool tools. Looking to try this out but the scripts cannot convert v1 models for me.
python create_yolo_caffemodel.py -m prototxt/yolo_tiny_train_val.prototxt -w tiny-yolo.weights -o tiny-yolo.caffemodel
yields
conv8_y(conv)
bn8(batchnorm)
scale8(scale)
fc9(fc)
Traceback (most recent call last):
File "create_yolo_caffemodel.py", line 106, in
main(sys.argv[1:])
File "create_yolo_caffemodel.py", line 85, in main
net.params[pr][0].data[...] = np.reshape(netWeights[count:count+weightSize], dims)
File "/usr/local/lib/python2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.9-x86_64.egg/numpy/core/fromnumeric.py", line 225, in reshape
return reshape(newshape, order=order)
ValueError: total size of new array must be unchanged
Probably the train_val in the repository does not match the weights model downloaded from the yolo website using wget http://pjreddie.com/media/files/tiny-yolo.weights
Question is where do I find the train_val for the tiny-yolo model?
Thanks.
Okay, I have a problem from the beginning!
I downloaded the cgf file from here,
https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov1/yolo.cfg
and then I tried with the first command to create prototxt file, like the following:
python create_yolo_prototxt.py CFG 'yolo.cfg' -prototxt text.prototxt
But it gives me:
error: unrecognized arguments: -prototxt
Okay, I hard coded the needed arguments from the source file to have a quick workaround, but when I run it it gives me a prototxt file with only one line:
name: "yolo"
What I've missed though?
and why I'm getting such an errors!
The documentation is not very well detailed :(
Thank you,
The following arguments are required: -p/--prototxt, -m/--model
HI,
I would like to convert a caffe model to a yolo one. Is this possible ?
Thx
I was trying to run create_yolo_caffemodel.py
on yolo_train_val.prototxt
and yolov1.weights
. However, I am getting the following error -
Traceback (most recent call last): File "create_yolo_caffemodel.py", line 113, in <module> main(sys.argv[1:]) File "create_yolo_caffemodel.py", line 92, in main net.params[pr][0].data[...] = np.reshape(netWeights[count:count+weightSize], dims) File "/usr/local/lib/python2.7/dist-packages/numpy/core/fromnumeric.py", line 232, in reshape return _wrapfunc(a, 'reshape', newshape, order=order) File "/usr/local/lib/python2.7/dist-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc return getattr(obj, method)(*args, **kwds) ValueError: cannot reshape array of size 134094654 into shape (4096,50176)
What seems to be causing this error?
PS - I have not changed anything and just trying to run exactly what's given in the README.
I am running the yolo_deploy.prototxt and get a runtime of 0.36 s for the net.forward_all. On GPU it takes 0.7 s for the same image (500x250px).
How can it be that the runtime takes longer in GPU mode (2 times)? Can this experience anyone confirm? Thank you in advance!
Edit: Do i need a certain version of cudnn?
Hi:
Guys, I have converted the weightings from darknet version and run it on caffe.
The performance is quite bad. The mAP is lower than 0.5
Can anyone report their AP of each class in the version?
After fixing a typo in the code (I guess) in create_yolo_prototxt.py as it says Relu
but caffe seems to want ReLU
, I could run both this script and create a prototxt which seems fine and create_yolo_caffemodel.py
which created a .caffemodel file without errors. I wonder if this was using an old version of caffe otherwise I cannot understand how could it work for others...
However, running it with a sample image taken from ImageNet with standard caffe python interface classify.py
script the result is not good. All classes get similar scores while the image I used gets a 0.99 score for the correct class with AlexNet. Anyone had the same problem? Is there anything I should be aware of when using create_yolo_caffemodel.py
?
According to the names of the files, it seems that the training part is provided. However, I am not able to understand how it works.
I modified yolo_main.py to work on video instead of image as follows . It doesn't however work.Is there anything else I need to change ?
net = caffe.Net(model_filename, weight_filename, caffe.TEST)
transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})
transformer.set_transpose('data', (2,0,1))
transformer.set_channel_swap('data', (2,1,0))
cap = cv2.VideoCapture(video_filename);
ret, img = cap.read();
while(ret):
inputs = img
out = net.forward_all(data=np.asarray([transformer.preprocess('data', inputs)]))
print out.iteritems()
img_cv = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
results = interpret_output(out['result'][0], img.shape[1], img.shape[0])
show_results(img_cv,results, img.shape[1], img.shape[0])
cv2.waitKey(10000)
ret, img = cap.read()
end = datetime.now()
Hi there, sorry about that to post this here, i was trying to write yolo in torch but struggled the backward function for so many days, but the gradients are always exploding slowly, could you kindly shed a light on my codes? Thank you so much.
gradInput[{ {}, {}, 1, {}, {} }] = self.mse:backward(torch.cmul(self.x_buffer, x, coord_mask), tx)
gradInput[{ {}, {}, 2, {}, {} }] = self.mse:backward(torch.cmul(self.y_buffer, y, coord_mask), ty)
gradInput[{ {}, {}, 3, {}, {} }] = self.mse:backward(torch.cmul(self.w_buffer, w, coord_mask), tw)
gradInput[{ {}, {}, 4, {}, {} }] = self.mse:backward(torch.cmul(self.h_buffer, h, coord_mask), th)
gradInput[{ {}, {}, 5, {}, {} }] = self.mse:backward(torch.cmul(self.conf_buffer, conf, coord_mask), tconf)
gradInput[{ {}, {}, { 6, 5 + nC }, {}, {} }][self.cls_mask] = self.ce:backward(torch.cmul(self.cls_buffer, cls), tcls)
I get these following errors when I try to run create_yolo_prototxt.py with the default cfg/yolo.cfg model
to create a new prototxt file.
ERROR:root:route layer is not supported
ERROR:root:reorg layer is not supported
ERROR:root:route layer is not supported
ERROR:root:region layer is not supported
Hello,
I am downloading the caffemodels from https://github.com/hojel/caffe-yolo-model which have non-static urls. Could you give me static URL's so that I can use them in my benchmarking.
Thanks,
Surabhi
I want to know how fast YOLO extract features, however, I found it quite slow than darknet.
I downloaded the cfg files from the link provided in the guide (https://github.com/pjreddie/darknet/tree/master/cfg/yolov1) but I am not able to convert it to prototxt. The result from running create_yolo_prototxt.py on any of those files is:
ERROR:root:local layer is not supported
ERROR:root:detection layer is not supported
It's pretty strange since those layers are included in every config file. Thank you for the suport.
When i running command :
python yolo_main.py -m prototxt/yolo_tiny_deploy.prototxt -w weights/yolo_tiny.caffemodel -i images/cat.jpg
I met error below:
F0220 18:45:25.861762 19763 net.cpp:767] Check failed: target_blobs.size() == source_layer.blobs_size() (1 vs. 2) Incompatible number of blobs for layer convX.
So I changed very bias_term in conv layer in yolo_tiny_deploy.prototxt, and change the num_output to 1024 to met the shape of source. then I can make it run but have no target detected. output is as below:
W0220 19:14:37.177127 20235 upgrade_proto.cpp:72] Note that future Caffe releases will only support input layers and not input fields.
I0220 19:14:37.188316 20235 net.cpp:761] Ignoring source layer conv9
I0220 19:14:37.188356 20235 net.cpp:761] Ignoring source layer relu9
I0220 19:14:37.188367 20235 net.cpp:761] Ignoring source layer fc10
I0220 19:14:37.188377 20235 net.cpp:761] Ignoring source layer fc11
I0220 19:14:37.188385 20235 net.cpp:761] Ignoring source layer fc12
total time is " milliseconds 236.246
<dictionary-itemiterator object at 0x7fbd4cc3f100>
259 194
Now there is Yolo v2 by link: http://pjreddie.com/darknet/yolo/
And old Yolo v1 is here: http://pjreddie.com/darknet/yolov1/
Can the caffe-yolo convert yolo's version 2 (.weights) files to caffemodel files by using create_yolo_caffemodel.py?
Or will it possible later?
it's nice to import your excellent project, but have you ever meet this error when you convert yolo model to caffemodel?
Traceback (most recent call last):
File "create_yolo_caffemodel.py", line 76, in
main(sys.argv[1:])
File "create_yolo_caffemodel.py", line 70, in main
net.params[pr][0].data[...] = np.reshape(netWeights[count:count+weightSize], dims)
File "/usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.py", line 218, in reshape
return reshape(newshape, order=order)
ValueError: total size of new array must be unchanged
hello, I find this work only has test srcipt, can you provide a training srcipt?
thank you very much~
What is the final command to create the prototxt?
When I tried the command
python create_yolo_prototxt.py yolo.cfg yolo.prototxt
I am getting the error
configparser.DuplicateOptionError: While reading from 'yolo.cfg' [line 38]: option 'batch_normalize' in section 'convolutional' already exists
NOTE: The module name is configparser in my system
Hence I used the following import command inside create_yolo_prototxt.py
from configparser import ConfigParser
instead of
from ConfigParser import ConfigParser
I am trying to use yolo-coco, but how to get prototxt?
When I try to run
create_yolo_prototxt.py the following error appears
ERROR:root:detection layer is not supported
I tried different cfg and prototxt files but still nothing.
Any ideas?
When I run the tiny yolo example provided in the repo (python yolo_main.py -w yolo_tiny.caffemodel -m prototxt/yolo_tiny_deploy.prototxt -i images/dog.jpg
)
I get the following error
I0926 13:23:49.339999 7553 net.cpp:261] This network produces output result
I0926 13:23:49.340031 7553 net.cpp:274] Network initialization done.
I0926 13:23:49.448806 7553 upgrade_proto.cpp:66] Attempting to upgrade input file specified using deprecated input fields: yolo_tiny.caffemodel
I0926 13:23:49.448825 7553 upgrade_proto.cpp:69] Successfully upgraded file specified using deprecated input fields.
W0926 13:23:49.448830 7553 upgrade_proto.cpp:71] Note that future Caffe releases will only support input layers and not input fields.
F0926 13:23:49.448843 7553 net.cpp:758] Check failed: target_blobs.size() == source_layer.blobs_size() (1 vs. 2) Incompatible number of blobs for layer conv1
*** Check failure stack trace: ***
Aborted (core dumped)
Was anyone able to solve this and run the tiny yolo example ??
Hi.
yolo.cfg changed and changing some layers, and add a layer of
[local]
size=3
stride=1
pad=1
filters=256
activation=leaky
Do you have any idea how to transform this layer to prototxt?
by using python3 i edited ConfigParser into configparser/Configparser and reinstall these file using pip3 and also use ConfigPasrer in python2.7 , but i got the same error for all time
pi@pi-HP-280-G1-MT:~/Downloads/YoloV2NCS-master/models/yolomodels$ python3 create_yolo_prototxt.py
Traceback (most recent call last):
File "create_yolo_prototxt.py", line 2, in
from ConfigParser import ConfigParser
ImportError: No module named 'ConfigParser'
Pls help me out
Hi there,
At yolo_main.py line 47 there is a bug:
classes_num_filtered = np.argmax(filter_mat_probs,axis=3)[filter_mat_boxes[0],filter_mat_boxes[1],filter_mat_boxes[2]]
should be
classes_num_filtered = np.argmax(probs,axis=3)[filter_mat_boxes[0],filter_mat_boxes[1],filter_mat_boxes[2]]
Basically, using argmax over filter_mat_probs
, which is a boolean matrix, instead of the actual probs
might cause picking the wrong class when more then one is available
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.