332 - All about image annotations​

Поділитися
Вставка
  • Опубліковано 11 вер 2024
  • This video tutorial walks you through the process of converting binary or labeled masks, often associated with scientific images, into coco style json annotations using python code. It also walks you through the process of converting the coco json annotations to YOLO v8 compatible annotations. As a bonus, I share code to display YOLO v8 annotations using python code.
    Code from this video is available here: github.com/bns...
    Part 1: Convert binary annotations to COCO JSON
    For each binary mask, the code extracts contours using OpenCV.
    These contours represent the boundaries of objects within the images. This is a key step in converting binary masks to polygon-like annotations.
    Then, convert the contours into annotations, including bounding boxes, area, and segmentation information. Each annotation is associated with an image ID, category ID, and other properties required by the COCO format.
    The code also creates an images section containing metadata about the images, such as their filenames, widths, and heights. In my example, I have used exactly the same file names for all images and masks so that a given mask can be easily mapped to the image.
    All the annotations, images, and categories are assembled into a dictionary that follows the COCO JSON format. This includes sections for "info," "licenses," "images," "categories," and "annotations."
    Finally, the assembled COCO JSON data is saved to a file, making it ready to be used with tools and frameworks that support the COCO data format.
    Part 2: Converting COCO JSON annotation to YOLO v8
    It reads coco style json annotations supplied as a single json file and also
    images as input.
    Here are the key steps in the code:
    1. Convert Images to YOLO Format: The convert_to_yolo function takes paths for input images and annotations (in JSON format), and directories to store the output images and labels. It then performs the following operations:
    - Reads the input JSON file containing annotations.
    - Copies all PNG images from the input directory to the output directory.
    - Normalizes the polygon segmentation data related to each image and writes them to text files, mapping them to the appropriate category (e.g., Alpha, Cells, Mito, Vessels).
    - The resulting text files contain information about the object category and the normalized coordinates of the polygons that describe the objects.
    2. Create YAML Configuration File: The create_yaml function takes paths to the input JSON file containing categories, training, validation, and optional test paths. It then:
    - Extracts the category names and the number of classes.
    - Constructs a dictionary containing information about class names, the number of classes, and paths to the training, validation, and test datasets.
    - Writes this dictionary to a YAML file, which can be used as a configuration file for training a model (e.g., a YOLO model).

КОМЕНТАРІ • 43

  • @Brickkzz
    @Brickkzz 11 місяців тому +5

    Thank you for your hard work to disseminate your knowledge, Sreeni. Greetings from the UK

  • @user-lb7dw7on1r
    @user-lb7dw7on1r 4 місяці тому +3

    your channel is literaly my BA computer science thesis

    • @user-lb7dw7on1r
      @user-lb7dw7on1r 4 місяці тому

      Thank you very much for it!!!11!!!1!!1!!!!

  • @chetlewis1540
    @chetlewis1540 11 місяців тому +2

    Thank you so much for all your tutorials! For our 3D data we now have all the tools to make labels, use them to train our own custom models (Detectron2/SAM etc) and create our binary masks. Could you PLEASE PLEASE create a tutorial on how we can then visualise our data as discrete 3D objects for downstream counting/quantification? Thank you Sreeni!!

  • @vivekyadav-eb1ic
    @vivekyadav-eb1ic 11 місяців тому

    Your information for the model is very helpful for us to get into the same phase that what is the model, exactly. It's very informative, please always keep it in all video series and your way of teaching code is wonderful. I am very grateful to you. Thank you sir🙏

  • @vivekyadav-zl5dl
    @vivekyadav-zl5dl 11 місяців тому

    Thank you sir, Your background information for the product and model is very helpful for us to get into the same phase that what is the model, exactly. It's very informative, please always keep it in all video series and your way of teaching code is marvellous. I am very grateful to you. Thanks🙏

  • @4_kris291
    @4_kris291 5 місяців тому

    Thanks a lot! Have seen many videos in your channel, those were really helpful!

  • @MHRlabs
    @MHRlabs 11 місяців тому

    Awesome video! Exactly the information I have been looking for. Much appreciated 👍

  • @naidinp
    @naidinp 11 місяців тому

    Thx for the quality of your videos and explanations - awesome like usual.

  • @tamerzohdy8589
    @tamerzohdy8589 11 місяців тому

    Thanks a lot for your great effort
    I wish to see tutorials on Yolo algorithm on instance segmentation on custom data

  • @vladimirkuzmenkov7285
    @vladimirkuzmenkov7285 5 місяців тому

    Thanks a lot, this is very valuable. I could not find this info anywhere else.

  • @alirezababaei5193
    @alirezababaei5193 5 місяців тому

    Thanks for sharing the video, it was helpful for me.

  • @salvadornunez23
    @salvadornunez23 10 місяців тому

    excelente tutorial, gracias x compartir estos contenidos saludos desde Argentina

  • @AaronFhd
    @AaronFhd 10 місяців тому

    would love a walk through for image masks to detectron2 then using our own model to detect and output the masks in the same folder structure

  • @bahikhalil6430
    @bahikhalil6430 11 місяців тому

    please keep explaining sir so we can fully understand the process
    and if you can make a video on yolo-nas on a costume dataset i would greatly appreciate it

  • @vandetamohammed2953
    @vandetamohammed2953 3 місяці тому

    thanks for your explaintion

  • @tilkesh
    @tilkesh 11 місяців тому

    Thank you very much.

  • @chellynabil6444
    @chellynabil6444 5 місяців тому

    hello thank you for the video yet i have a problem ihave a dataset with multi masks on the the same pictures with diffrent shades of gray is it possible to convert it to yolo v8 labels or to binary masks for each image then yolo v8

  • @deusexmachina291
    @deusexmachina291 9 місяців тому

    This is very nice! But I am having difficulty in converting json file to coco json file. Can you help me with it?

  • @seanolivieri4829
    @seanolivieri4829 4 місяці тому

    I have the base img and color masked image and I am stuck at making a decent json file (there are >9k images so nope I am not labelling them again) does any1 know the solution?

  • @DeepakKumar-ub4mw
    @DeepakKumar-ub4mw 10 місяців тому

    sir how you have created binary masks for each category of object from images

  • @hfarmani
    @hfarmani 11 місяців тому

    really thanks

  • @sithibanu9019
    @sithibanu9019 11 місяців тому

    thank u sir , can i use this yolov8 for hippocampus segmentation from brain MRI

  • @nursyafiqahsyafiahbintimda2494
    @nursyafiqahsyafiahbintimda2494 8 місяців тому

    why is when i run it said file_name is not defined

  • @sithibanu9019
    @sithibanu9019 11 місяців тому

    sir, could you please explain about Perceptilabs

  • @maryamtabatabaei8123
    @maryamtabatabaei8123 7 місяців тому

    Thanks!

  • @Akash-nn2xi
    @Akash-nn2xi 11 місяців тому

    Thanks

  • @bijaynayak6473
    @bijaynayak6473 7 місяців тому

    appreciate

  • @mohamedtalafha2705
    @mohamedtalafha2705 11 місяців тому

    Please, I have question about image isolation by color, like the sunspot images there are black and gray, umbra and penumbra. I want to separate then to calculate the ratio of umbra to penumbra. Can you please help me . Every thing in black and gray , I will send the image hear

    • @cattnation6257
      @cattnation6257 5 місяців тому

      no one will replay

    • @joaosousa9620
      @joaosousa9620 5 місяців тому

      @@cattnation6257 what does that mean?

    • @cattnation6257
      @cattnation6257 5 місяців тому

      @@joaosousa9620 everybody is busy brother

    • @joaosousa9620
      @joaosousa9620 5 місяців тому

      @@cattnation6257 Ah, reply. But yes, the question should be more focused.

    • @cattnation6257
      @cattnation6257 5 місяців тому

      @@joaosousa9620 yeah I can understand his question why and only work on image last two weeks why can't a person who work on 7 8 year can't understand it?

  • @user-bt1vx7du3e
    @user-bt1vx7du3e 11 місяців тому

    thanks

  • @vivekyadav-eb1ic
    @vivekyadav-eb1ic 11 місяців тому

    Thanks!