Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix serialize bug when using AutoAnnotation runner #810

Merged
merged 1 commit into from
Oct 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions utils/auto_annotation/run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ def main():

from cvat.apps.engine.serializers import LabeledDataSerializer

# NOTE: We're actually using `run_inference_engine_annotation`
# incorrectly here. The `mapping` dict is supposed to be a mapping
# of integers -> integers and represents the transition from model
# integers to the labels in the database. We're using a mapping of
# integers -> strings. For testing purposes, this shortcut is fine.
# We just want to make sure everything works. Until, that is....
# we want to test using the label serializer. Then we have to transition
# back to integers, otherwise the serializer complains about have a string
# where an integer is expected. We'll just brute force that.

for shape in results['shapes']:
# Change the english label to an integer for serialization validation
shape['label_id'] = 1

serializer = LabeledDataSerializer(data=results)

if not serializer.is_valid():
Expand Down