Giter Site home page Giter Site logo

annotation_utils's Introduction

Github Stats

annotation_utils's People

Contributors

cm107 avatar darwinharianto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

annotation_utils's Issues

Polygon to rectangle bounding box

Hello,

I looked at your github profile and I realized that you have written several convert for Labelme to COCO. I know that we can generate oriented bounding box using polygon using labelme tool.

Do you know how to convert polygon bounding box to rectangle bounding box (you can find more information here:labelmeai/labelme#542)? Do you have written any script for this type of converter?

Thanking you!

KeyError occurs when loading instances_val2014.json with COCO_Dataset.load_from_path

Hi,

I hope to convert COCO to labelme format.

After install pyclay-annotation_utils via pip,

pip uninstall typing -y
pip install cython
pip install pyclay-annotation_utils 

I wanna load COCO dataset

from annotation_utils.coco.structs import COCO_Dataset

dataset = COCO_Dataset.load_from_path(
    json_path='/dataset/cocodataset/annotations/instances_val2014.json',
    img_dir='/dataset/cocodataset/val2014',
)

then I got this KeyError:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-16-e72b8906eed7> in <module>
      2 
      3 dataset = COCO_Dataset.load_from_path(
----> 4     json_path='/dataset/cocodataset/annotations/instances_val2014.json',
      5      img_dir='/dataset/cocodataset/val2017',
      6 )

/usr/local/lib/python3.7/dist-packages/annotation_utils/coco/structs/dataset.py in load_from_path(cls, json_path, img_dir, check_paths, strict)
    306         check_file_exists(json_path)
    307         json_dict = json.load(open(json_path, 'r'))
--> 308         dataset = COCO_Dataset.from_dict(json_dict, strict=strict)
    309         if img_dir is not None:
    310             check_dir_exists(img_dir)

/usr/local/lib/python3.7/dist-packages/annotation_utils/coco/structs/dataset.py in from_dict(cls, dataset_dict, strict)
    180             licenses=COCO_License_Handler.from_dict_list(dataset_dict['licenses']),
    181             images=COCO_Image_Handler.from_dict_list(dataset_dict['images']),
--> 182             annotations=COCO_Annotation_Handler.from_dict_list(dataset_dict['annotations'], strict=strict),
    183             categories=COCO_Category_Handler.from_dict_list(dataset_dict['categories'], strict=strict)
    184         )

/usr/local/lib/python3.7/dist-packages/annotation_utils/coco/structs/handlers.py in from_dict_list(cls, dict_list, strict)
    269     def from_dict_list(cls, dict_list: List[dict], strict: bool=True) -> COCO_Annotation_Handler:
    270         return COCO_Annotation_Handler(
--> 271             annotation_list=[COCO_Annotation.from_dict(ann_dict, strict=strict) for ann_dict in dict_list]
    272         )
    273 

/usr/local/lib/python3.7/dist-packages/annotation_utils/coco/structs/handlers.py in <listcomp>(.0)
    269     def from_dict_list(cls, dict_list: List[dict], strict: bool=True) -> COCO_Annotation_Handler:
    270         return COCO_Annotation_Handler(
--> 271             annotation_list=[COCO_Annotation.from_dict(ann_dict, strict=strict) for ann_dict in dict_list]
    272         )
    273 

/usr/local/lib/python3.7/dist-packages/annotation_utils/coco/structs/objects.py in from_dict(cls, ann_dict, strict)
    318                     'segmentation', 'num_keypoints', 'area',
    319                     'iscrowd', 'keypoints', 'image_id',
--> 320                     'bbox', 'category_id', 'id'
    321                 ]
    322             )

/usr/local/lib/python3.7/dist-packages/common_utils/check_utils/check_utils.py in check_required_keys(item_dict, required_keys, var_name)
    130         logger.error(f"provided_keys: {provided_keys}")
    131         logger.error(f"missing_keys: {missing_keys}")
--> 132         raise KeyError

KeyError: 

Could you help me to resolve it?

Thx.

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.