hhk7734 / tensorflow-yolov4

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

How to get the coordinates of the bounding box in YOLOv4? #77

Closed Markmichelin closed 3 years ago

Markmichelin commented 3 years ago

Sorry i want to know How to get the coordinates of the bounding box in YOLOv4? thanks

hhk7734 commented 3 years ago

https://github.com/hhk7734/tensorflow-yolov4/blob/3d31292cefba198b1528a90b3f435204efe7be73/py_src/yolov4/tf/__init__.py#L105-L131

https://github.com/hhk7734/tensorflow-yolov4/blob/3d31292cefba198b1528a90b3f435204efe7be73/py_src/yolov4/common/base_class.py#L152-L156

Put an image in predict(). Then, you can get the bbox.

Markmichelin commented 3 years ago

Sorry i want to run in v2.1.0 what can i do ?

hhk7734 commented 3 years ago

https://wiki.loliot.net/docs/lang/python/libraries/yolov4/python-yolov4-about#tensorflow

from yolov4.tf import YOLOv4

yolo = YOLOv4()
# yolo = YOLOv4(tiny=True)

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

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

frame = cv2.imread(media_path) 
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) 

bboxes = self.predict(frame_rgb)