hhk7734 / tensorflow-yolov4

YOLOv4 Implemented in Tensorflow 2.
MIT License
136 stars 75 forks source link

Training/Conversion with non-square input #19

Closed alexanderswerdlow closed 4 years ago

alexanderswerdlow commented 4 years ago

Would it be possible to support rectangular inputs for training/conversion?

hhk7734 commented 4 years ago

Even if rectangular input is supported, there is no way to evaluate it now because the training process is not working properly.

After fixing and tuning the training process, I'll consider supporting that.

lidorshimoni commented 4 years ago

does it support rectangular input now? thanks

hhk7734 commented 4 years ago

@lidorshimoni Not yet. I'm a little busy now, so I'm going to try it next week.

hhk7734 commented 4 years ago

a817585c9297cbd44d41634d6caf09bcf40b8761 ~ 253369a23ad3eb1009ea0f815c406fe43643fb44

I pushed the above commits. It will be released after several tests.

If you want to test before release, download or clone this repo. then try the below code.

import cv2
from py_src.yolov4.tf import YOLOv4

yolo = YOLOv4(tiny=True)
yolo.classes = "coco.names"
yolo.input_size = (640, 480)

yolo.make_model()
yolo.load_weights("yolov4-tiny.weights", weights_type="yolo")

# Tested on Ubuntu 20.04
yolo.inference(
    "/dev/video0",
    is_image=False,
    cv_apiPreference=cv2.CAP_V4L2,
    cv_frame_size=(640, 480),
    cv_fourcc="YUYV",
)
hhk7734 commented 4 years ago

Release v2.0.0