Code Monkey home page Code Monkey logo

Comments (4)

toxic-0518 avatar toxic-0518 commented on May 19, 2024 1

finally I found the way.

  1. Convert your own dataset to coco-format
  2. put the dataset folder in, or link it to "./datasets/ ". "." is the working directory where you execute train_net.py
    the structure should be:
    --datasets
    | |--coco
    | | |--annotations
    | | | |--instances_train2017.json
    | | | |--instances_val2017.json
    | | |--train2017
    | | | |--[put your train images here]
    | | |--val2017
    | | | |--[put your val images here]
    (pay attention to folder name and annotation json file name)
  3. find the path of Detecton2 (search your python site-packages)
    and then find detectron2/data/datasets/builtin_meta.py
    locate the method named " _get_coco_instances_meta()"
    comment all the code before return ret and insert your own code
def _get_coco_instances_meta():
    #thing_ids = [k["id"] for k in COCO_CATEGORIES if k["isthing"] == 1]
    #thing_colors = [k["color"] for k in COCO_CATEGORIES if k["isthing"] == 1]
    #assert len(thing_ids) == 80, len(thing_ids)
    ## Mapping from the incontiguous COCO category id to an id in [0, 79]
    #thing_dataset_id_to_contiguous_id = {k: i for i, k in enumerate(thing_ids)}
    #thing_classes = [k["name"] for k in COCO_CATEGORIES if k["isthing"] == 1]
    #ret = {
    #    "thing_dataset_id_to_contiguous_id": thing_dataset_id_to_contiguous_id,
    #    "thing_classes": thing_classes,
    #    "thing_colors": thing_colors,
    #}
    ret = {
        "thing_dataset_id_to_contiguous_id": {your class id mapping}
        # for example : {0:0, 1:1} 
        "tining_classes": [your class names]
        # for example : ["person", "bird"]
        "thing_colors": [color for different class]
        # for example : [[0, 255, 0], [255, 0, 0]]
    return ret
  1. run train_net.py in your working directory.

from adelaidet.

tianzhi0549 avatar tianzhi0549 commented on May 19, 2024

@toxic-0518 Thank you for your question. We directly make use of the data loader in detectron2, so you can refer to the document of detectron2 to know how to use your own data.

from adelaidet.

toxic-0518 avatar toxic-0518 commented on May 19, 2024

ok, I'll look into detectron2 dataloader.
Thank you!

from adelaidet.

tianzhi0549 avatar tianzhi0549 commented on May 19, 2024

@toxic-0518 thank you very much for sharing it here:-).

from adelaidet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.