Git Product home page Git Product logo

Comments (2)

CPFLAME avatar CPFLAME commented on June 2, 2024 2

感谢使用centerX,没关系,大家都是从菜鸟起步的。

如果是标准的coco格式的话,建议直接调用detectron2的接口,在data/dataset/builting.py中添加的就可以

from detectron2.data import MetadataCatalog
from detectron2.data.datasets import register_coco_instances
register_coco_instances("my_dataset", {}, "json_annotation.json", "path/to/image/dir")
MetadataCatalog.get("my_dataset").thing_classes = ["person", "dog"]

如果是私人数据集,可以仿照data/dataset/crowd_human.py来添加私人数据集,私人数据集不限标准,只要最后的返回统一格式就可以了,然后在data/dataset/builting.py中register一下你的私人数据集,就可以训练了。

        instances = []

        for obj in anno['gtboxes']:
            cls = obj['tag']
            if cls != "person":
                continue
            bbox = obj['vbox']
            bbox = [float(x) for x in bbox]
            bbox[2] = bbox[0] + bbox[2]
            bbox[3] = bbox[1] + bbox[3]
            bbox[0] = max(bbox[0], 0.0)
            bbox[1] = max(bbox[1], 0.0)
            bbox[2] = min(bbox[2], float(w))
            bbox[3] = min(bbox[3], float(h))
            if bbox[2] - bbox[0] > 1.0 and bbox[3] - bbox[1] > 1.0:
                instances.append(
                    {"category_id": class_names.index(cls),
                     "bbox": bbox,
                     "bbox_mode": BoxMode.XYXY_ABS}
                )
        r["annotations"] = instances
        if len(instances) > 0:
            dicts.append(r)

centerX并没有对detectron2的数据注册方式进行修改,如果想知道详情可以参见detectron2的官方文档
点我

from centerx.

neowei1218 avatar neowei1218 commented on June 2, 2024

我会再去试试看,你写得真是详细,谢谢你! !

from centerx.

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.