leetenki / yolov2 Goto Github PK
View Code? Open in Web Editor NEWYOLOv2のchainerの再現実装です(darknetのchainerローダと、完全なchainer上での訓練コードを含みます)
License: MIT License
YOLOv2のchainerの再現実装です(darknetのchainerローダと、完全なchainer上での訓練コードを含みます)
License: MIT License
The following lines in lib/utils.py result in a 0 value for some images in my case:
input_width *= min_pixel / min_edge
input_height *= min_pixel / min_edge
AND
input_width *= max_pixel / max_edge
input_height *= max_pixel / max_edge
Which in turn causes "cv2.resize(img, (input_width, input_height))" to fail with an error. Changing these lines to something like "input_height *= max_pixel / (max_edge * 1.0)" fixes the problem for me
Could you please explain how did you choose anchors ?
self.anchors = [[5.375, 5.03125], [5.40625, 4.6875], [2.96875, 2.53125], [2.59375, 2.78125], [1.9375, 3.25]]
I think what is mentioned in the original arXiv paper is ambiguous. I found a discussion on the official mailing list: https://groups.google.com/forum/#!searchin/darknet/anchors%7Csort:relevance/darknet/qrcGefJ6d5g/VaPBCeGaAwAJ
You can answer in Japanese if you prefer.
他の方が英語で書いていたので英語で書きましたが、日本語の方が好きでしたら、そちらでも構いません。よろしくお願いします。
I'd like to know if the accuracy was also reproduced.
Have you tried this?
I run the training programs to detect animal icons according to YOLOv2_animal_train.md , but partial_weights.py
failed to dump as below in my environment.
$ python partial_weights.py
Traceback (most recent call last):
File "partial_weights.py", line 9, in <module>
from yolov2_grid_prob import *
ModuleNotFoundError: No module named 'yolov2_grid_prob'
I cannot find the module called yolov2_grid_prob
. Could you give me some advice on what shoud I do?
https://github.com/YunYang1994/tensorflow-yolov3 hope it helps you
@leetenki
Failed to run image_generator.py because randint arg is negative number
I got the errors in the image_generator.py .
First:
File "image_generate.py", line 24, in <module>
delta_val_scale=0.5
File "/home/autoware/workspace/chainer_ws/YOLOv2/lib/image_generator.py", line 171, in generate_samples
tmp_image, bbox = random_overlay_image(sample_image, item, minimum_crop)
File "/home/autoware/workspace/chainer_ws/YOLOv2/lib/image_generator.py", line 76, in random_overlay_image
x = int(np.random.randint(src_w-scale_item_w) - shift_item_w)
File "mtrand.pyx", line 977, in mtrand.RandomState.randint (numpy/random/mtrand/mtrand.c:16117)
ValueError: low >= high
Second:
loading image generator...
loading model...
start training
Traceback (most recent call last):
File "darknet19_train.py", line 62, in <module>
delta_val_scale=0.5
File "/home/autoware/workspace/chainer_ws/YOLOv2/lib/image_generator.py", line 161, in generate_samples
bg = self.bgs[np.random.randint(len(self.bgs))]
File "mtrand.pyx", line 977, in mtrand.RandomState.randint (numpy/random/mtrand/mtrand.c:16117)
ValueError: low >= high
when I was executing
python yolov2_darknet_parser.py yolo.weights
I had a error like,
File "yolov2_darknet_parser.py", line 87, in <module>
exec(txt)
File "<string>", line 1, in <module>
ValueError: cannot reshape array of size 12265129 into shape (1024,3072,3,3)
Is the model construction correct ?
After stat training, I encountered this error in darknet19_train.py
Do you have information about this?
Traceback (most recent call last):
File "", line 75, in
y, loss, accuracy = model(x, one_hot_t)
File "/Users/-/darknet19.py", line 122, in call
y = self.predictor(x)
File "/Users/-/darknet19.py", line 85, in call
h = F.leaky_relu(self.bias1(self.bn1(self.conv1(x), test=not self.train, finetune=self.finetune)), slope=0.1)
File "/Users/-/.pyenv/versions/anaconda3-4.3.1/envs/py3yolo/lib/python3.5/site-packages/chainer/links/normalization/batch_normalization.py", line 117, in call
kwargs, test='test argument is not supported anymore. '
File "/Users/-/.pyenv/versions/anaconda3-4.3.1/envs/py3yolo/lib/python3.5/site-packages/chainer/utils/argument.py", line 4, in check_unexpected_kwargs
raise ValueError(message)
ValueError: test argument is not supported anymore. Use chainer.using_config
what does the 'file' refer to and what it should be?
thank you.
Even though I use the GPU on this program, it only get 2 frames per second of FPS.
How do I get around 20 frames per second?
Bounding boxがオリジナルのdarknetのものより小さめに出る気がするのですが、何かコメントありますか?
hey guys, i got the value error when i tried the training tutorial.
the below is the whole message
=================================================================================
loading image generator...
loading model...
/home/kaku/anaconda3/lib/python3.5/site-packages/chainer/cuda.py:90: UserWarning: cuDNN is not enabled.
Please reinstall chainer after you install cudnn
(see https://github.com/pfnet/chainer#installation).
'cuDNN is not enabled.\n'
start training
Traceback (most recent call last):
File "darknet19_train.py", line 62, in
delta_val_scale=0.5
File "/home/kaku/Desktop/YOLOv2-master/lib/image_generator.py", line 180, in generate_samples
bg = self.bgs[np.random.randint(len(self.bgs))]
File "mtrand.pyx", line 988, in mtrand.RandomState.randint (numpy/random/mtrand/mtrand.c:16157)
ValueError: low >= high
=================================================================================
REALLY NEED HELP, PLEASE
GTX1060の6GBでTrainingしようとして、メモリが足りない的なメッセージが出たのですが、
leetenkiさんがお使いのGPUは何なのでしょうか?
参考までにお教え願えないでしょうか?
hey guys, i started train YOLOv2 using the tutorial.
but when i finish it and then run
python darknet19_predict.py items/Dog.png
this code, always get incorrect output like below.
##############################################
loading image...
loading model...
1Tyrannosaurus : 44.34%
6Dog : 33.14%
5Rhino : 21.69%
9Parasarolophus : 0.37%
3Triceratops : 0.30%
4Riopururodon : 0.09%
7Erasmosaurus : 0.03%
8Ammonite : 0.02%
10Deer : 0.02%
2Brachiosaurus : 0.01%
##############################################
or if i change the png file to deer, will get like below output.
##############################################
python darknet19_predict.py items/10Deer.png
loading image...
loading model...
1Tyrannosaurus : 99.96%
5Rhino : 0.03%
6Dog : 0.01%
9Parasarolophus : 0.00%
8Ammonite : 0.00%
2Brachiosaurus : 0.00%
4Riopururodon : 0.00%
7Erasmosaurus : 0.00%
10Deer : 0.00%
3Triceratops : 0.00%
##############################################
did anyone get the same trouble? or any idea to fix this?
REALLY NEED HELP, thank you.
Could you please provide English descriptions of your code? It's really hard to read the Japanese files.
Please O(∩_∩)O~
As shown in the paper, the multi-scale training can import the mAP on VOC 2007 test set by 1.4. Has multi-scale training been implemented by YOLOv2?
Can anyone provide the yolov2_darknet model file for coco dataset?!
Line 66 in cd2b69c
Hi!
Thanks for your really nicely documented work! I had a quick question on the above snippet ^^. Why is it that you multiply the final centroid width and height by the grid width and height?
In my use case, the centroid widths and height correspond to say 20 pixels in the true image. I imagine this should then be divided by the grid width and height to determine the final anchor values (as the anchor values are multiplied by the grid width and height correct?).
Could you help me understand why you instead multiply by the grid dimensions to get the anchor values? If I did this method I would get anchor values of (260 etc.)
what is the second term in the loss? I cannot find it in yolo v1 paper.
Why do you want the no-responsible boxes' center to be in the center of the grid?
Is it just for stabling the training in early stage?
Anchor_default is written as 1.0 in YOLOv2.md, but in real code (yolov2.py), tw and th are set to 0 when no object exists. Please tell me which is correct.
YOLOv2.mdでanchor_defaultは1.0と表記されていますが、実際のコード(yolov2.py)では物体が存在しない場合はtw及びthに0が設定されています。どちらが正しいのかご教授お願い致します。
Original yolov2_train.py is based on images generated by merging foreground and background.
and the darknet19_train.py has only image classification.
And now, I wanna train yolov2 with Deepfashion Dataset with bbox.
I've made a image_generate script to output data, t.
data is the numpy array of an image;
t is the x,y,w,h,label for the data.
My chainer version is 4.
Also, delete the test = ... in yolov2.py (such as line 92), and use with chainer.using_config('train', True) in the yolov2_train.py, and with x, t = generate_samples(n_samples=1, width=input_width,height=input_height)
to generate 1 sample to debug.
comment out the debug_print.
During batch 1, everything's fine. but during batch 2, the self.conv1(x) will output NaN while x has real values.
My guess is the the W for conv1 is too large, but I can't verify it.
Has anyone encountered this problem? It'll be very kind that you guys can give me some hints.
The dataset I use is In-shop Clothes Retrieval Benchmark http://mmlab.ie.cuhk.edu.hk/projects/DeepFashion.html, just upper-body, lower-body, full-body, 3 classes.
Here are the corresponding file
Does someone compare performance with darknet?
In my implementation, the detection speed is slower, and GPU usage rate is lower than darknet.
I have adjusted yolov2.py and yolov2_predict.py for my own dataset.
Please let me know if you have any idea to make the use of GPU more efficient in these source codes.
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 encountered this error in yolov2.py
Could you tell me how to fix it.
python yolov2_train.py
loading image generator...
item_files = ...
loading initial model...
start training
Traceback (most recent call last):
File "yolov2_train.py", line 82, in
loss = model(x, t)
File "/home/dl-box/YOLOv2/yolov2.py", line 168, in call
x_shift = Variable(np.broadcast_to(np.arange(grid_w), x.shape[1:]))
AttributeError: 'module' object has no attribute 'broadcast_to'
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.