Robinatp / YOLO_Tensorflow

YOLO( You Only Look Once,including YOLOv1,YOLOv2,YOLOv3) using tensorflow ,including train/detected and export pb script. Convert darknet weight to tensorflow.Implement YOLO with TF_Slim
25 stars 12 forks source link

can't covert self-trained YOLOV3-tiny weights #3

Open adam1982510 opened 5 years ago

adam1982510 commented 5 years ago

hi, I used yolov3-tiny.cfg training self-labeled images(only 3 classes), just modify last [convolutional] filters=24 in yolov3-tiny.cfg, it worked well in darknet test . it failed when I use YOLO_V3_Tiny_convert_darkenet_to_Tensorflow.py to convert my trained yolov3 weights to tf. but its success to convert official yolov3-tiny.weighs and worked. I just changed the filepath of my weights in YOLO_V3_Tiny_convert_darkenet_to_Tensorflow.py without any other changes. error message : <tf.Variable 'yolov3_tiny/RPN_detector/Predict_2/Conv_1/biases:0' shape=(24,) dtype=float32_ref> 8674720 var1: <tf.Variable 'yolov3_tiny/RPN_detector/Predict_2/Conv_1/weights:0' shape=(1, 1, 256, 24) dtype=float32_ref> shape: [1, 1, 256, 24] weights: 6143 Traceback (most recent call last): File "/Users/fengjialiang/code/fjl/pyqt/gitexample/YOLO_Tensorflow/Darknet2Tensorflow/darknet-master/YOLO_V3_Tiny_convert_darkenet_to_Tensorflow.py", line 582, in yolov3_tiny_net = YOLOV3_Tiny(weights_file=FLAGS.darknet_weights_file) File "/Users/fengjialiang/code/fjl/pyqt/gitexample/YOLO_Tensorflow/Darknet2Tensorflow/darknet-master/YOLO_V3_Tiny_convert_darkenet_to_Tensorflow.py", line 73, in init self.load_ops = self._load_weights(tf.global_variables(scope='yolov3_tiny'), weights_file) File "/Users/fengjialiang/code/fjl/pyqt/gitexample/YOLO_Tensorflow/Darknet2Tensorflow/darknet-master/YOLO_V3_Tiny_convert_darkenet_to_Tensorflow.py", line 166, in _load_weights var_weights = weights[ptr:ptr + num_params].reshape((shape[3], shape[2], shape[0], shape[1])) ValueError: cannot reshape array of size 6143 into shape (24,256,1,1)

adam1982510 commented 5 years ago

I tried to train 80classes the same as official yolov3-tiny-cfg, it seems that the length of weights what I trained, less 1 than official trained yolov3-tiny-weights, it seems how weird :(

adam1982510 commented 5 years ago

I git pull the newest version of https://github.com/AlexeyAB/darknet.git, and rebuild the darknet, its seems that the newest version has fix the this issue. :)

smartwell commented 5 years ago

I git pull the newest version of https://github.com/AlexeyAB/darknet.git, and rebuild the darknet, its seems that the newest version has fix the this issue. :)

yes! i have same problem like your, new version is ok??