Skip to content

Commit a32813c

Browse files
isak-jakobssonjohan-hultberg-work
authored andcommitted
yolov5: Fix incorrect parsing of coco labels
1 parent aaccf5c commit a32813c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

object-detection-yolov5/app/labelparse.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,17 @@ void parse_labels(char*** labels_ptr,
123123
}
124124
}
125125

126+
// Filter out "n/a" entries by compacting the array.
127+
size_t valid_label_count = 0;
128+
for (size_t i = 0; i < num_lines; i++) {
129+
if (strcmp(label_array[i], "n/a") != 0) {
130+
label_array[valid_label_count] = label_array[i];
131+
valid_label_count++;
132+
}
133+
}
134+
126135
*labels_ptr = label_array;
127-
*num_labels_ptr = num_lines;
136+
*num_labels_ptr = valid_label_count;
128137
*label_file_buffer = labels_data;
129138

130139
close(labels_fd);

0 commit comments

Comments
 (0)