mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
scripts/libraries: Fix yolov2 and yolov5 variable naming.
This commit is contained in:
parent
3e46eee35a
commit
727d3200a2
@ -100,11 +100,11 @@ class yolo_v2_postprocess:
|
|||||||
return e_x / np.sum(e_x, axis=1, keepdims=True)
|
return e_x / np.sum(e_x, axis=1, keepdims=True)
|
||||||
|
|
||||||
# Reshape the output to a 2D array
|
# Reshape the output to a 2D array
|
||||||
colum_outputs = outputs[0].reshape((oh * ow * self.anchors_len,
|
row_outputs = outputs[0].reshape((oh * ow * self.anchors_len,
|
||||||
_YOLO_V2_CLASSES + class_count))
|
_YOLO_V2_CLASSES + class_count))
|
||||||
|
|
||||||
# Threshold all the scores
|
# Threshold all the scores
|
||||||
score_indices = sigmoid(colum_outputs[:, _YOLO_V2_SCORE])
|
score_indices = sigmoid(row_outputs[:, _YOLO_V2_SCORE])
|
||||||
score_indices = np.nonzero(score_indices > self.threshold)
|
score_indices = np.nonzero(score_indices > self.threshold)
|
||||||
if isinstance(score_indices, tuple):
|
if isinstance(score_indices, tuple):
|
||||||
score_indices = score_indices[0]
|
score_indices = score_indices[0]
|
||||||
@ -112,7 +112,7 @@ class yolo_v2_postprocess:
|
|||||||
return _NO_DETECTION
|
return _NO_DETECTION
|
||||||
|
|
||||||
# Get the bounding boxes that have a valid score
|
# Get the bounding boxes that have a valid score
|
||||||
bb = np.take(colum_outputs, score_indices, axis=0)
|
bb = np.take(row_outputs, score_indices, axis=0)
|
||||||
|
|
||||||
# Extract rows, columns, and anchor indices
|
# Extract rows, columns, and anchor indices
|
||||||
bb_rows = score_indices // (ow * self.anchors_len)
|
bb_rows = score_indices // (ow * self.anchors_len)
|
||||||
@ -169,10 +169,10 @@ class yolo_v5_postprocess:
|
|||||||
class_count = oc - _YOLO_V5_CLASSES
|
class_count = oc - _YOLO_V5_CLASSES
|
||||||
|
|
||||||
# Reshape the output to a 2D array
|
# Reshape the output to a 2D array
|
||||||
colum_outputs = outputs[0].reshape((oh * ow, _YOLO_V5_CLASSES + class_count))
|
row_outputs = outputs[0].reshape((oh * ow, _YOLO_V5_CLASSES + class_count))
|
||||||
|
|
||||||
# Threshold all the scores
|
# Threshold all the scores
|
||||||
score_indices = colum_outputs[:, _YOLO_V5_SCORE]
|
score_indices = row_outputs[:, _YOLO_V5_SCORE]
|
||||||
score_indices = np.nonzero(score_indices > self.threshold)
|
score_indices = np.nonzero(score_indices > self.threshold)
|
||||||
if isinstance(score_indices, tuple):
|
if isinstance(score_indices, tuple):
|
||||||
score_indices = score_indices[0]
|
score_indices = score_indices[0]
|
||||||
@ -180,7 +180,7 @@ class yolo_v5_postprocess:
|
|||||||
return _NO_DETECTION
|
return _NO_DETECTION
|
||||||
|
|
||||||
# Get the bounding boxes that have a valid score
|
# Get the bounding boxes that have a valid score
|
||||||
bb = np.take(colum_outputs, score_indices, axis=0)
|
bb = np.take(row_outputs, score_indices, axis=0)
|
||||||
|
|
||||||
# Get the score information
|
# Get the score information
|
||||||
bb_scores = bb[:, _YOLO_V5_SCORE]
|
bb_scores = bb[:, _YOLO_V5_SCORE]
|
||||||
|
Loading…
Reference in New Issue
Block a user