leetenki / YOLOv2

YOLOv2のchainerの再現実装です(darknetのchainerローダと、完全なchainer上での訓練コードを含みます)
MIT License
338 stars 88 forks source link

how to use yolov2_darknet_parser.py ? #2

Open nsknsl opened 7 years ago

nsknsl commented 7 years ago

what does the 'file' refer to and what it should be? thank you.

leetenki commented 7 years ago

https://github.com/leetenki/YOLOv2/blob/master/YOLOv2_execute.md

Just follow this. Download pre-trained darknet weights file, then convert it to chainer's weights file.

aliceyayunji commented 7 years ago

image Anyone has this problem when using yolov2_darknet_parser.py ?

usatie commented 7 years ago

@aliceyayunji I got the same error too. This seems to be caused by the difference between the num of parameters given and the num of parameters required. The shape of dat is like this. (the num of parameters given) (50983561,)

And it is the num of the parameters in yolo.weights. But the num of the parameters required is 67465609. (It can be calculated as offset so I got it by comment out all of exec().)

I don't know what to do though...

usatie commented 7 years ago
2017-04-19 22 09 27

https://pjreddie.com/darknet/yolo/

It says the file size is 258MB, however the file I downloaded by the link is only 203.9MB. The given parameters can be insufficient.

yukkysaito commented 7 years ago

@leetenki I got the same problem. If anyone can solve, pls tell.

loading yolo.weights
loading initial model...
1 992
2 19680
3 93920
4 102368
5 176608
6 472544
7 505824
8 801760
9 1983456
10 2115552
11 3297248
12 3429344
13 4611040
14 9333728
15 9860064
16 14582752
17 15109088
18 19831776
19 29273056
20 38714336
Traceback (most recent call last):
  File "yolov2_darknet_parser.py", line 86, in <module>
    exec(txt)
  File "<string>", line 1, in <module>
ValueError: cannot reshape array of size 12265129 into shape (1024,3072,3,3)
yoshi4417 commented 7 years ago

Solved Download yolo.weights (258MB) from here and use it https://drive.google.com/drive/folders/0B1tW_VtY7onidEwyQ2FtQVplWEU

godspysonyou commented 7 years ago

@yoshi4417 I have went to https://drive.google.com/drive/folders/0B1tW_VtY7onidEwyQ2FtQVplWEU,,,but I saw the yolo.weights is 194MB,can it solve the problem?

yoshi4417 commented 7 years ago

@godspysonyou It looks it has been re-updated... I uploaded old version of yolo.weights https://drive.google.com/open?id=0B4kMaWAXZNSWcUJCVW1aOHV0MkU Please use it :)

Siii92 commented 7 years ago

I have the problem.

Traceback (most recent call last): File "yolov2_darknet_predict.py", line 86, in predictor = CocoPredictor() File "yolov2_darknet_predict.py", line 24, in init serializers.load_hdf5(weight_file, yolov2) # load saved model File "/usr/local/lib/python2.7/dist-packages/chainer/serializers/hdf5.py", line 125, in load_hdf5 d.load(obj) File "/usr/local/lib/python2.7/dist-packages/chainer/serializer.py", line 85, in load obj.serialize(self) File "/usr/local/lib/python2.7/dist-packages/chainer/link.py", line 687, in serialize d[name].serialize(serializer[name]) File "/usr/local/lib/python2.7/dist-packages/chainer/link.py", line 481, in serialize serializer(name, d[name].data) File "/usr/local/lib/python2.7/dist-packages/chainer/serializers/hdf5.py", line 101, in call dataset.read_direct(value) File "/usr/lib/python2.7/dist-packages/h5py/_hl/dataset.py", line 573, in read_direct for mspace in dest_sel.broadcast(source_sel.mshape): File "/usr/lib/python2.7/dist-packages/h5py/_hl/selections.py", line 296, in broadcast raise TypeError("Can't broadcast %s -> %s" % (target_shape, count)) TypeError: Can't broadcast (1024, 3072, 3, 3) -> (3072, 3072, 3, 3)

anyone please tell me how to fix it

knasim commented 6 years ago

me too >>> ValueError: cannot reshape array of size 4943738 into shape (1024,1024,3,3)

I downloaded the following weights file:
https://pjreddie.com/media/files/tiny-yolo.weights