david8862 / keras-YOLOv3-model-set

end-to-end YOLOv4/v3/v2 object detection pipeline, implemented on tf.keras with different technologies
MIT License
640 stars 222 forks source link

Inference for yolov4-tiny-darknet is giving error #220

Open Abhishek672 opened 2 years ago

Abhishek672 commented 2 years ago

Hey @david8862, Thanks for such amazing work.

I am having problem doing inference on yolov4tiny using yolo.py. I have converted .weights to .h5 and generated a anchors.txt file. while running the snippet :

!python yolo.py --model_type=tiny_yolo4_darknet \ --weights_path=weights/keras_darknet.h5 \ --anchors_path=weights/keras_darknet_anchors.txt \ --classes_path=configs/classes.txt \ --image \ --input=img_0001.jpg \ --output=result.jpg

I am getting error : ValueError('This model type is not supported now') Traceback (most recent call last): File "yolo.py", line 91, in _generate_model yolomodel, = get_yolo3_model(self.model_type, num_feature_layers, num_anchors, num_classes, input_shape=self.model_input_shape + (3,), model_pruning=self.pruning_model) File "/content/keras-YOLOv3-model-set/yolo3/model.py", line 228, in get_yolo3_model raise ValueError('This model type is not supported now') ValueError: This model type is not supported now

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "yolo.py", line 437, in main() File "yolo.py", line 409, in main yolo = YOLO_np(**vars(args)) File "yolo.py", line 69, in init self.yolo_model = self._generate_model() File "yolo.py", line 104, in _generate_model assert yolo_model.layers[-1].output_shape[-1] == \ UnboundLocalError: local variable 'yolo_model' referenced before assignment.

Is this repository compatible with AlexyAB yolov4-tiny darknet?

Thanks

david8862 commented 2 years ago

@Abhishek672 sorry I didn't involve tiny_yolo4_darknet model type in official process support. Maybe you can try validate_yolo.py for inference if you have been able to convert the darknet .cfg and .weights to Keras .h5

Abhishek672 commented 2 years ago

So @david8862, If I choose yolov4-tiny with cspdarknet53 tiny as the backbone, It is not possible to do the training. Do you know any other repositories where this is implemented?

Thanks