Coder Social home page Coder Social logo

caffe-yolo's People

Contributors

hojel avatar xingwangsfu avatar

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  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  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

caffe-yolo's Issues

Convolution layers have no bias?

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!

Getting yolo->caffe prototxt architectures to learn in caffe

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.

I got this error 'std::bad_alloc'

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

convert weights

Hey,

  1. in create_yolo_prototxt.py in case of convolution layer , in case of activation = leaky , the implementation in darknet is x>0 ? x : 0.1 * x, so this means that in the prototxt in Relu layer should be also negative_slope: 0.1, or am i missing something?
    2)after converting yolov1-tiny.cfg to prototxt and the tiny-yolov1.weights into caffe model weights when i run the yolo_main.py - i am getting very different results from the original darknet. i read the darknet implementation and the create_yolo_caffemodel.py and the caffe implementation and everything looks ok, what am i missing?

thank you

Fine Tuning

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 ?

Converting v1 tiny-yolo fails

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.

create_yolo_prototxt.py, missing arguments

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,

Error message:

The following arguments are required: -p/--prototxt, -m/--model

Caffe model to YOLO

HI,

I would like to convert a caffe model to a yolo one. Is this possible ?

Thx

"ValueError: cannot reshape array" while running create_yolo_caffemodel.py

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.

CPU mode faster than GPU mode??

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?

Model not giving expected results after conversion from Darknet to Caffe

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?

Training

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.

Run yolo_main.py on video

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()

Question on yolo backward function

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)

Few layers in YOLOv2 not supported in this model yet

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

ERROR:root:region layer is not supported

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

conversion error

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

Unable to run create_yolo_prototxt.py

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

ERROR:root:detection layer is not supported

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?

Tiny yolo provided in the examples not working

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 ??

train val for yolo not work

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?

unable to convert cfg into prototxt file

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

Detection code bug

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

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.