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

Add respective frames to YOLO dump #891

Closed
rishacha opened this issue Dec 3, 2019 · 2 comments · Fixed by #906
Closed

Add respective frames to YOLO dump #891

rishacha opened this issue Dec 3, 2019 · 2 comments · Fixed by #906
Assignees
Labels
enhancement New feature or request

Comments

@rishacha
Copy link

rishacha commented Dec 3, 2019

Description
I don't know if this feature already exists, but to train a darknet YOLOv3 model, I need to also get the frames and obj.data generated. The model gives an obj.names but there is no obj.data present and I would like to generate this for training a detector.

Can I try making a change for the same?

Proposed change

## Add the image file somewhere here?
with ZipFile(file_object, "w") as output_zip:
        for frame_annotation in annotations.group_by_frame():
            image_name = frame_annotation.name
            annotation_name = "{}.txt".format(os.path.splitext(os.path.basename(image_name))[0])
            width = frame_annotation.width
            height = frame_annotation.height

            # TODO : Add this line
'''
            output_zip.write(image_name,{}.jpg".format(os.path.splitext(os.path.basename(image_name))[0]), 
compression=Optional)
'''

            yolo_annotation = ""
            for shape in frame_annotation.labeled_shapes:
                if shape.type != "rectangle":
                    continue

                label = shape.label
                yolo_bb = convert_to_yolo((width, height), shape.points)
                yolo_bb = " ".join("{:.6f}".format(p) for p in yolo_bb)
                yolo_annotation += "{} {}\n".format(labels_ids[label], yolo_bb)
     
            output_zip.writestr(annotation_name, yolo_annotation)
        output_zip.writestr("obj.names", "\n".join(l[0] for l in sorted(labels_ids.items(), key=lambda x:x[1])))
@nmanovic
Copy link
Contributor

nmanovic commented Dec 3, 2019

@rishacha , please work with @zhiltsov-max who is own the feature. He is developing a new framework to export datasets in different formats to facilitate the training procedure.

@nmanovic nmanovic added the enhancement New feature or request label Dec 3, 2019
@nmanovic nmanovic added this to the Backlog milestone Dec 3, 2019
@rishacha
Copy link
Author

rishacha commented Dec 3, 2019

@zhiltsov-max , Please let me know how I can help. Thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants