KMnP / fashionpedia-api

Python API for Fashionpedia Dataset
https://fashionpedia.github.io/home
BSD 2-Clause "Simplified" License
159 stars 29 forks source link

getImgIds() doesn't return the combination of images from multiple category ids #13

Closed yuxiangning closed 3 years ago

yuxiangning commented 3 years ago

First of all, thank you for sharing your work! While running the following code modified from the demo, looks like fp.getImgIds() doesn't return the correct combination of images from multiple category ids. The code is as follows:

`import numpy as np import os

from fashionpedia.fp import Fashionpedia

anno_file = "./data/sample.json" img_root = "./images"

fp = Fashionpedia(anno_file)

cat_ids = [24] img_ids = fp.getImgIds(catIds=cat_ids) print("category ", cat_ids, " has img ids ", img_ids)

cat_ids = [6] img_ids = fp.getImgIds(catIds=cat_ids) print("category ", cat_ids, " has img ids ", img_ids)

cat_ids = [10] img_ids = fp.getImgIds(catIds=cat_ids) print("category ", cat_ids, " has img ids ", img_ids)

cat_ids = [6, 24] img_ids = fp.getImgIds(catIds=cat_ids) print("category ", cat_ids, " has img ids ", img_ids)

cat_ids = [6, 24, 10] img_ids = fp.getImgIds(catIds=cat_ids) print("category ", cat_ids, " has img ids ", img_ids) `

The output is:

category [24] has img ids [9813] category [6] has img ids [10223] category [10] has img ids [9813] category [6, 24] has img ids [] category [6, 24, 10] has img ids []

I think the last two outputs should be [9813, 10223]? Or I'm miss understanding the meaning of getImgIds()?

Thanks ~

KMnP commented 3 years ago

Thanks for your question. The output of cat_ids = [6, 24], cat_ids = [6, 24, 10] should be []. Since the definition of fp.getImgIds() is to get the images that satisfy all the conditions.

You can also checkout cocoapi, we used the same definition.

yuxiangning commented 3 years ago

I see, that makes sense. Thank you for clarification!

KMnP commented 3 years ago

I will close the issue now. Let me know if you have any other questions