![]() If desired, you can comment out the last option to set a maximum samples size. # To download the COCO dataset for only the "person" and "car" classes Once you have the package installed, simply run the following to get say the "person" and "car" classes: import fiftyone.zoo as foz More information about installation can be found at. Nowadays there is a package called fiftyone with which you could download the MS COCO dataset and get the annotations for specific classes only. So you might want to slice the images list to the first n. Note that this will save all images from the specified category. ![]() With open('.path_saved_ims/coco_person/' + im, 'wb') as handler: We can now use requests to GET the images and write them into a local folder: # Save the images into a local folder Which returns a list of dictionaries with basic information on the images and its url. # Get the corresponding image ids and images using loadImgs # Specify a list of category names of interestĬatIds = coco.getCatIds(catNms=) # instantiate COCO specifying the annotations json pathĬoco = COCO('.path_to_annotations/instances_train2014.json') ![]() Now here's an example on how we could download a subset of the images containing a person and saving it in a local file: from co import COCO
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |