pjreddie / darknet

Convolutional Neural Networks
http://pjreddie.com/darknet/
Other
25.84k stars 21.33k forks source link

Tiny YOLO V2 cfg and weights AssertionError #603

Open lobbie opened 6 years ago

lobbie commented 6 years ago

Hi,

I downloaded the yolov2-tiny.cfg and the yolov2-tiny.weights from the Darknet (https://pjreddie.com/darknet/yolo/) site and run the command,

python flow --model cfg/yolov2-tiny.cfg --load bin/yolov2-tiny.weights --demo CCTV_GJ_Sample_88secs.mp4 --saveVideo.

However I got an AssertionError. I read somewhere this is due to mismatching cfg and weights files. Can you please advise how can I fix this or get the correct files?

Thanks, Lobbie

Neo-Vincent commented 6 years ago

in face, the link is https://pjreddie.com/media/files/yolov2-voc.weights, which is not available but the link https://pjreddie.com/media/files/yolo-voc.weights is available, which is yolov2-voc.weight, you can have a try ^_^

lobbie commented 6 years ago

Vincent, but I am looking for the correct pair of yolov2-tiny.cfg and the corresponding yolov2-tiny.weights file. Are you saying the yolov2-tiny.cfg can be used on yolov2-voc.weights file? thanks.

mikeknapp commented 6 years ago

I have the same issue. Darknet website lists two files for YOLO 2 Tiny: https://pjreddie.com/media/files/yolov2-tiny.weights and https://github.com/pjreddie/darknet/blob/master/cfg/yolov2-tiny.cfg

Maybe darkflow doesn't work on v2 files yet? Not sure.

Anyway, I could get something working by:

  1. Download yolo-tiny.weights from here: https://drive.google.com/drive/folders/0B1tW_VtY7onidEwyQ2FtQVplWEU

  2. python3 flow --model cfg/v1/yolo-tiny.cfg --load bin/yolo-tiny.weights --savepb --verbalise (Note the v1 in the cfg path)

lobbie commented 6 years ago

@mikeknapp - Noted your suggestion and will use it when I need to use tiny yolo. thanks.

Srini511 commented 6 years ago

Hello, I tried to use yolov2-voc.cfg and yolov2-voc.weights from the links above. I get the following error.

OMP_NUM_THREADS=28 numactl --cpunodebind=0 --membind=0 ./flow --model cfg/yolov2-voc.cfg --load yolov2-voc.weights --imgdir ../../tensorflow-YoloV2/JPEGImages/

Parsing ./cfg/yolov2-voc.cfg Parsing cfg/yolov2-voc.cfg
Loading yolov2-voc.weights ... Traceback (most recent call last): File "./flow", line 6, in cliHandler(sys.argv)
File "/ec/fm/disks/aipg_lab_home_pool_02/sriniva2/yolov2/darkflow/darkflow/cli.py", line 26, in cliHandler tfnet = TFNet(FLAGS)
File "/ec/fm/disks/aipg_lab_home_pool_02/sriniva2/yolov2/darkflow/darkflow/net/build.py", line 58, in init darknet = Darknet(FLAGS)
File "/ec/fm/disks/aipg_lab_home_pool_02/sriniva2/yolov2/darkflow/darkflow/dark/darknet.py", line 27, in init self.load_weights()
File "/ec/fm/disks/aipg_lab_home_pool_02/sriniva2/yolov2/darkflow/darkflow/dark/darknet.py", line 82, in load_weights wgts_loader = loader.create_loader(args)
File "/ec/fm/disks/aipg_lab_home_pool_02/sriniva2/yolov2/darkflow/darkflow/utils/loader.py", line 105, in create_loader return load_type(path, cfg)
File "/ec/fm/disks/aipg_lab_home_pool_02/sriniva2/yolov2/darkflow/darkflow/utils/loader.py", line 19, in init
self.load(
args)
File "/ec/fm/disks/aipg_lab_home_pool_02/sriniva2/yolov2/darkflow/darkflow/utils/loader.py", line 77, in load
walker.offset, walker.size)
AssertionError: expect 202704260 bytes, found 202704264

yli3 commented 6 years ago

I've experienced the above, too, with exactly this four byte discrepancy (found four extra), although I can't remember which cfg I used exactly in darkflow.

I wonder if there's a small, fixable issue here. Did the OP also get this?

ZeeDeep commented 5 years ago

you should run these commands in ubuntu Terminal to download these files For cfg file : wget https://github.com/pjreddie/darknet/blob/master/cfg/yolov2-tiny.cfg For weights file : wget https://pjreddie.com/media/files/yolov2-tiny.weights

xiaorannuo commented 5 years ago

you should run these commands in ubuntu Terminal to download these files For cfg file : wget https://github.com/pjreddie/darknet/blob/master/cfg/yolov2-tiny.cfg For weights file : wget https://pjreddie.com/media/files/yolov2-tiny.weights

This is coco dataset

iseegr8tfuldeadppl commented 5 years ago

It seems that the PJ Reddie files are not fully compatible, so I have to download the pre built weights from the provided link in the README: https://drive.google.com/drive/folders/0B1tW_VtY7onidEwyQ2FtQVplWEU

dhodyrahmad commented 5 years ago

https://stackoverflow.com/questions/44674517/yolo-darknet-detecting-only-specific-class-like-person-cat-dog-etc

have you checked this?

sarvesh123456 commented 5 years ago

Set self.offset value to 20 in loader.py file