Open pingchesu opened 4 years ago
@pingchesu I also meet the same issue when converting the tiny-yolov4 weights:
Parsing section route_10
Concatenating route layers: [<tf.Tensor 'up_sampling2d/resize/ResizeNearestNeighbor:0' shape=(?, ?, ?, 128) dtype=float32>, <tf.Tensor 'leaky_re_lu_13/LeakyRelu:0' shape=(?, ?, ?, 256) dtype=float32>]
Parsing section convolutional_19
conv2d bn leaky (3, 3, 384, 256)
Traceback (most recent call last):
File "tools/model_converter/convert.py", line 311, in <module>
_main(parser.parse_args())
File "tools/model_converter/convert.py", line 153, in _main
buffer=weights_file.read(weights_size * 4))
TypeError: buffer is too small for requested array
not sure if there's any mismatch between .cfg and .weights. May need to check with author.
@david8862 I have found this project https://github.com/yuto3o/yolox
The author did not use yolov4-tiny configs.
The author just create yolov4-tiny model and read weights from yolov4-tiny.weights
Below is my testing code:
import os
import time
from absl import app, flags
from tensorflow.keras import optimizers
from core.utils import decode_cfg, load_weights
from core.dataset import Dataset
from core.callbacks import COCOEvalCheckpoint, CosineAnnealingScheduler, WarmUpScheduler
from core.utils.optimizers import Accumulative
from core.model.one_stage.yolov4 import YOLOv4_Tiny as Model
from core.model.one_stage.yolov4 import YOLOLoss as Loss
import numpy as np
num = 61
epochs = 50
cfg = decode_cfg('./cfgs/coco_yolov4_tiny.yaml')
model, eval_model = Model(cfg)
init_weight = 'yolov4-tiny.weights'
load_weights(model, init_weight)
Hope this information can help you
Really thanks!!
@pingchesu many thanks. I checked this repo and generally from the implementation of .weights loading, it should have no big difference with convert.py. May need peer-to-peer comparison and carefully debugging to get more clue
@david8862 Have you solved this problem?
@PureHing I haven't got enough bandwidth to fix it yet. Sorry for trouble...
Hi sorry for bothering again!!
I haved tried tiny-yolov4 recently, however, when I convert the weights i got
The weight and configs are from https://github.com/AlexeyAB/darknet#pre-trained-models
Below is my command:
python3 tools/convert.py --yolo4_reorder cfg/yolov4-tiny.cfg cfg/yolov4-tiny.weights weights/yolov4-tiny.h5
Can you help convert the tiny model if you have free time!!
Really appreciate for your great work!!!