Open vinorth-v opened 3 years ago
Should I change something here or somewhere else?
config.py
#YOLO options
__C.YOLO = edict()
__C.YOLO.CLASSES = "./data/classes/obj_old.names"
__C.YOLO.ANCHORS = [12,16, 19,36, 40,28, 36,75, 76,55, 72,146, 142,110, 192,243, 459,401]
__C.YOLO.ANCHORS_V3 = [10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326]
__C.YOLO.ANCHORS_TINY = [23,27, 37,58, 81,82, 81,82, 135,169, 344,319] # yolov4-tiny-2l.cfg (mask = 1,2,3)
#__C.YOLO.ANCHORS_TINY = [10,14, 23,27, 37,58, 81,82, 135,169, 344,319] # yolov4-tiny-2l-custom.cfg (mask = 0,1,2)
#__C.YOLO.ANCHORS_TINY = [12,16, 19,36, 40,28, 36,75, 76,55, 72,146, 142,110, 192,243, 459,401] # yolov4-tiny-3l-custom.cfg (mask = 0,1,2) -> not working
__C.YOLO.STRIDES = [8, 16, 32]
__C.YOLO.STRIDES_TINY = [16, 32]
__C.YOLO.XYSCALE = [1.2, 1.1, 1.05]
__C.YOLO.XYSCALE_TINY = [1.05, 1.05] #yolov4-tiny-2l
#__C.YOLO.XYSCALE_TINY = [1.05, 1.05, 1.05] #yolov4-tiny-3l-custom.cfg -> not working
__C.YOLO.ANCHOR_PER_SCALE = 3
__C.YOLO.IOU_LOSS_THRESH = 0.5
yolov4.py
def YOLOv4_tiny(input_layer, NUM_CLASS):
route_1, conv = backbone.cspdarknet53_tiny(input_layer)
conv = common.convolutional(conv, (1, 1, 512, 256))
conv_lobj_branch = common.convolutional(conv, (3, 3, 256, 512))
conv_lbbox = common.convolutional(conv_lobj_branch, (1, 1, 512, 3 * (NUM_CLASS + 5)), activate=False, bn=False)
conv = common.convolutional(conv, (1, 1, 256, 128))
conv = common.upsample(conv)
conv = tf.concat([conv, route_1], axis=-1)
conv_mobj_branch = common.convolutional(conv, (3, 3, 128, 256))
conv_mbbox = common.convolutional(conv_mobj_branch, (1, 1, 256, 3 * (NUM_CLASS + 5)), activate=False, bn=False)
return [conv_mbbox, conv_lbbox]
I am facing the same issue for yolov4-tiny-3l
model. How did you solve this problem?
Hi @aditya-5842, unfortunately not, still facing this issue. And it seems this repo is not going to be updated anymore... @hunglc007
@vinorth05 After working 6-8 hrs, I am able to convert yolov4-tiny-3l
from darknet
framework to `TensorFlow framework. Now it is working for me.
There are many things are required to make it work. Soon I will update this repo by forking it.
@vinorth05 You can check this branch. It is working for me. https://github.com/aditya-5842/tensorflow-yolov4-tflite/tree/yolov4-tiny-3l-fix
You can see the necessary changes here.
Hi @aditya-5842, thank you for sharing this! I will try your changes when I have time and get back to you!
Edit: It works great, thank you!
However, it is strange that when I compare results with my test dataset, yolov4-2l model has better results than yolov4-3l model. (It is supposed to be the opposite, like when I tested with darknet)
Do you think you missed some parameters?
Yes, YOLOV4-Tiny-3l is supposed to give better results than YOLOV4-Tiny (2l). I trained both models for detecting a single class and I got better results with YOLOV4-Tiny (2l).
I think I have handled the parameters carefully. In my case result of darknet and TensorFlow were same (for images).
Can you share the examples where TensorFlow output is different than darknet output.
Hello,
I don't understand, the results are perfect with my darknet model but after converting to TF, the detection results are 2-3 times smaller for the bounding boxes.
I am using this config file https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-tiny-3l.cfg
By running the command above, the bounding boxes are way smaller like these:
Do I need to change something in your code? How should I modify the anchors?
Thanks