Fixed per-class grouping of predictions

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2019-09-13 13:48:58 +02:00
parent 75f4e4cb1e
commit 6a990b204a

View File

@ -91,14 +91,23 @@ def prepare_predictions(predictions: Sequence[Sequence[Sequence[Union[int, float
ymin += 1 ymin += 1
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])
# Round the box coordinates to reduce the required memory.
confidence = box[1]
class_id = int(box[0]) xmin = round(box[xmin])
# Round the box coordinates to reduce the required memory. ymin = round(box[ymin])
confidence = box[1] xmax = round(box[xmax])
xmin = round(box[2]) ymax = round(box[ymax])
ymin = round(box[3])
xmax = round(box[4])
ymax = round(box[5])
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)