Skip to content

Commit 51cfab1

Browse files
benhoffnmanovic
authored andcommitted
fix serialize bug when using AutoAnnotation runner (#810)
1 parent 9a9f3fa commit 51cfab1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

utils/auto_annotation/run_model.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,20 @@ def main():
111111

112112
from cvat.apps.engine.serializers import LabeledDataSerializer
113113

114+
# NOTE: We're actually using `run_inference_engine_annotation`
115+
# incorrectly here. The `mapping` dict is supposed to be a mapping
116+
# of integers -> integers and represents the transition from model
117+
# integers to the labels in the database. We're using a mapping of
118+
# integers -> strings. For testing purposes, this shortcut is fine.
119+
# We just want to make sure everything works. Until, that is....
120+
# we want to test using the label serializer. Then we have to transition
121+
# back to integers, otherwise the serializer complains about have a string
122+
# where an integer is expected. We'll just brute force that.
123+
124+
for shape in results['shapes']:
125+
# Change the english label to an integer for serialization validation
126+
shape['label_id'] = 1
127+
114128
serializer = LabeledDataSerializer(data=results)
115129

116130
if not serializer.is_valid():

0 commit comments

Comments
 (0)