Changes to pass lint checks

This commit is contained in:
Anil Ozyalcin 2023-02-16 22:20:35 -08:00
parent 10155d3b3e
commit e7436a413c

View File

@ -140,12 +140,13 @@ class OvDetector(DetectionApi):
scores = np.max(output_data[:, 4:], axis=1) scores = np.max(output_data[:, 4:], axis=1)
if len(scores) == 0: if len(scores) == 0:
return np.zeros((20, 6), np.float32) return np.zeros((20, 6), np.float32)
scores = np.expand_dims(scores, axis=1) scores = np.expand_dims(scores, axis=1)
dets = np.concatenate((output_data, scores), axis=1) # add scores to the last column # add scores to the last column
dets = dets[dets[:,-1] > 0.5,:] # filter out lines with scores below threshold dets = np.concatenate((output_data, scores), axis=1)
# filter out lines with scores below threshold
ordered = dets[dets[:, -1].argsort()[::-1]][:20] # limit to top 20 scores, descending order dets = dets[dets[:, -1] > 0.3, :]
# limit to top 20 scores, descending order
ordered = dets[dets[:, -1].argsort()[::-1]][:20]
detections = np.zeros((20, 6), np.float32) detections = np.zeros((20, 6), np.float32)
i = 0 i = 0
@ -170,9 +171,11 @@ class OvDetector(DetectionApi):
elif self.ov_model_type == ModelTypeEnum.yolov5: elif self.ov_model_type == ModelTypeEnum.yolov5:
out_tensor = infer_request.get_output_tensor() out_tensor = infer_request.get_output_tensor()
output_data = out_tensor.data[0] output_data = out_tensor.data[0]
conf_mask = (output_data[:, 4] >= 0.5).squeeze() # filter out lines with scores below threshold
conf_mask = (output_data[:, 4] >= 0.3).squeeze()
output_data = output_data[conf_mask] output_data = output_data[conf_mask]
ordered = output_data[output_data[:, 4].argsort()[::-1]][:20] # limit to top 20 scores, descending order # limit to top 20 scores, descending order
ordered = output_data[output_data[:, 4].argsort()[::-1]][:20]
detections = np.zeros((20, 6), np.float32) detections = np.zeros((20, 6), np.float32)
i = 0 i = 0