Closed SokPhanith closed 3 years ago
You can refer to yolov5_trt.py to implement it by yourself.
I try run it and edit some code but I don't know why I got index of class sometime > 100 or sometime got wrong
You have to debug it yourself, since you have modified it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@wang-xinyu If it's any use, here are the following modifications I did to get the yolov5_trt.py file working with YOLOv3:
post_process
function to:
def post_process(self, output, origin_h, origin_w):
num = int(output[0])
# Reshape to a two dimentional ndarray
pred = np.reshape(output[1:], (-1, 7))[:num, :]
if pred.shape[0] > 0:
pred[:,4] *= pred[:,6]
pred = pred[:,:-1]
# Do nms
boxes = self.non_max_suppression(pred, origin_h, origin_w, conf_thres=CONF_THRESH, nms_thres=IOU_THRESHOLD)
result_boxes = boxes[:, :4] if len(boxes) else np.array([])
result_scores = boxes[:, 4] if len(boxes) else np.array([])
result_classid = boxes[:, 5] if len(boxes) else np.array([])
return result_boxes, result_scores, result_classid
For anyone else wondering the reason to the modifications, the output of YOLOv3 seemed to contain the objectness and class scores, so it was 7 elements in each prediction rather than YOLOv5's expected 6 elements (x,y,cw,ch,cls_id,cls_conf).
@vjsrinivas Can you please raise PR to add a yolov3_trt.py?
I will submit a PR in a couple days if someone else doesn't get to it first.
Env
About this repo
yolov3-tiny
Your problem
Sorry, When I build yolov3-tiny I run detection with ./yolov3-tiny -d ../sample. It's work . How can get example with python detection with yolov3-tiny.engine and also scaled-yolov4, yolov3, yolov3-spp, yolov4