Fixed per-class grouping of predictions
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
@ -92,13 +92,22 @@ def prepare_predictions(predictions: Sequence[Sequence[Sequence[Union[int, float
|
|||||||
xmax += 1
|
xmax += 1
|
||||||
ymax += 1
|
ymax += 1
|
||||||
|
|
||||||
|
if len(box) > nr_classes:
|
||||||
|
class_id = np.argmax(box[:-5])
|
||||||
|
confidence = np.amax(box[:-5])
|
||||||
|
xmin = -5
|
||||||
|
ymin = -4
|
||||||
|
xmax = -3
|
||||||
|
ymax = -2
|
||||||
|
else:
|
||||||
class_id = int(box[0])
|
class_id = int(box[0])
|
||||||
# Round the box coordinates to reduce the required memory.
|
# Round the box coordinates to reduce the required memory.
|
||||||
confidence = box[1]
|
confidence = box[1]
|
||||||
xmin = round(box[2])
|
|
||||||
ymin = round(box[3])
|
xmin = round(box[xmin])
|
||||||
xmax = round(box[4])
|
ymin = round(box[ymin])
|
||||||
ymax = round(box[5])
|
xmax = round(box[xmax])
|
||||||
|
ymax = round(box[ymax])
|
||||||
prediction = (image_id, confidence, xmin, ymin, xmax, ymax)
|
prediction = (image_id, confidence, xmin, ymin, xmax, ymax)
|
||||||
# Append the predicted box to the results list for its class.
|
# Append the predicted box to the results list for its class.
|
||||||
results[class_id].append(prediction)
|
results[class_id].append(prediction)
|
||||||
|
|||||||
Reference in New Issue
Block a user