cocodataset / cocoapi

COCO API - Dataset @ http://cocodataset.org/
Other
6.07k stars 3.75k forks source link

Can I pick some classes picture using this code? #67

Open Anhaoxu opened 7 years ago

Anhaoxu commented 7 years ago

hi, can I pick 6 classes pictures to use? coco has too many classes, which in some cases is not useful, so how to pick some interest class to become a new small coco dataset for me to use ?

vchiley commented 7 years ago

cell [7] of coco/PythonAPI/pycocoDemo.ipynb

# get all images containing given categories, select one at random
catIds = coco.getCatIds(catNms=['person','dog','skateboard']);
imgIds = coco.getImgIds(catIds=catIds );

you can choose the catIds based on the catNms you want (i.e. 'person','dog','skateboard', etc.) then load only the images with those classes.

that what you need???

32l commented 6 years ago

hi, vchiley, the ref code load only the images with special classes. is there some guideline for pick the special classes's annotations?

swatinair123 commented 5 years ago

Hi how can i save all the images of a particular class to a folder?

Rahul-Venugopal commented 5 years ago

Is it possible to pull only few class images and annotation and save it in a folder using coco api ?

swatinair123 commented 5 years ago

Yes. Give the names of the classes required.

On Thu 20 Dec, 2018, 5:03 PM Rahul-Venugopal <notifications@github.com wrote:

Is it possible to pull only few class images and annotation and save it in a folder using coco api ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cocodataset/cocoapi/issues/67#issuecomment-448966030, or mute the thread https://github.com/notifications/unsubscribe-auth/AWbURMOZES4H-yl4n8videE4U2mYkRo5ks5u63VvgaJpZM4O_lh5 .

PimwipaV commented 5 years ago

https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocotools/coco.py