YAD2K icon indicating copy to clipboard operation
YAD2K copied to clipboard

cannot derive h5 weights from cfg and .weights files for COCO based yolo model.

Open abramjos opened this issue 7 years ago • 3 comments

I was trying to get the weights of the COCO dataset trained with yolo(I dont know which version is it) and I cannot generate weights properly:

This is the command I have used to get the weights:: ---> yolo-coco.weights and yolo-coco.cfg are from Joseph Redmon(pjreddie) git only.

./yad2k.py weights_cfg/yolo-coco.cfg weights_cfg/yolo-coco.weights model_data/yolo_coco.h5 The result it yeilds is

Using TensorFlow backend.
Loading weights.
Weights Header:  [       0        1        0 12800000]
Parsing Darknet config.
Creating Keras model.
Parsing section net_0
Parsing section convolutional_0
conv2d bn leaky (7, 7, 3, 64)
2017-12-12 13:31:28.840505: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2017-12-12 13:31:29.005534: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:892] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2017-12-12 13:31:29.005994: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 0 with properties: 
name: GeForce GTX 1060 major: 6 minor: 1 memoryClockRate(GHz): 1.6705
pciBusID: 0000:01:00.0
totalMemory: 5.93GiB freeMemory: 5.33GiB
2017-12-12 13:31:29.006013: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1)
Parsing section maxpool_0
Parsing section convolutional_1
conv2d bn leaky (3, 3, 64, 192)
Parsing section maxpool_1
Parsing section convolutional_2
conv2d bn leaky (1, 1, 192, 128)
Parsing section convolutional_3
conv2d bn leaky (3, 3, 128, 256)
Parsing section convolutional_4
conv2d bn leaky (1, 1, 256, 256)
Parsing section convolutional_5
conv2d bn leaky (3, 3, 256, 512)
Parsing section maxpool_2
Parsing section convolutional_6
conv2d bn leaky (1, 1, 512, 256)
Parsing section convolutional_7
conv2d bn leaky (3, 3, 256, 512)
Parsing section convolutional_8
conv2d bn leaky (1, 1, 512, 256)
Parsing section convolutional_9
conv2d bn leaky (3, 3, 256, 512)
Parsing section convolutional_10
conv2d bn leaky (1, 1, 512, 256)
Parsing section convolutional_11
conv2d bn leaky (3, 3, 256, 512)
Parsing section convolutional_12
conv2d bn leaky (1, 1, 512, 256)
Parsing section convolutional_13
conv2d bn leaky (3, 3, 256, 512)
Parsing section convolutional_14
conv2d bn leaky (1, 1, 512, 512)
Parsing section convolutional_15
conv2d bn leaky (3, 3, 512, 1024)
Parsing section maxpool_3
Parsing section convolutional_16
conv2d bn leaky (1, 1, 1024, 512)
Parsing section convolutional_17
conv2d bn leaky (3, 3, 512, 1024)
Parsing section convolutional_18
conv2d bn leaky (1, 1, 1024, 512)
Parsing section convolutional_19
conv2d bn leaky (3, 3, 512, 1024)
Parsing section convolutional_20
conv2d bn leaky (3, 3, 1024, 1024)
Parsing section convolutional_21
conv2d bn leaky (3, 3, 1024, 1024)
Parsing section convolutional_22
conv2d bn leaky (3, 3, 1024, 1024)
Parsing section convolutional_23
conv2d bn leaky (3, 3, 1024, 1024)
Parsing section local_0
Traceback (most recent call last):
  File "./yad2k.py", line 270, in <module>
    _main(parser.parse_args())
  File "./yad2k.py", line 249, in _main
    'Unsupported section header type: {}'.format(section))
ValueError: Unsupported section header type: local_0

when I am using some other config file like yolo.cfg, a large no of weights is not being used! (x)

Saved Keras model to model_data/coco.h5
Read 50983561 of 234210543.0 from Darknet weights.
Warning: 183226982.0 unused weights

But no detection in this model(since it is incomplete)..

abramjos avatar Dec 12 '17 08:12 abramjos

I'm having the same error. Did you ever figure it out?

Nirvan101 avatar Jun 08 '18 08:06 Nirvan101

its working fine for me, you can work on yolo v3 instead I guess! You can try https://github.com/qqwweee/keras-yolo3! Let me know if its working! There is a workaround for this, But I have to recollect :O

abramjos avatar Jun 08 '18 09:06 abramjos

Check that the version of yolo and the weights match up.

This error came up for me when I tried to use yolov3 weights with yolov2.

danieljbrooks avatar Jan 23 '19 19:01 danieljbrooks