kwcoco.examples.faq module

These are answers to the questions: How do I?

kwcoco.examples.faq.get_images_with_videoid()[source]

Q: How would you recommend querying a kwcoco file to get all of the images associated with a video id?

kwcoco.examples.faq.get_all_channels_in_dataset()[source]

Q. After I load a kwcoco.json into a kwcoco_dset, is there a nice way to query what channels are available for the input imagery? It looks like I can iterate over .imgs and build my own set, but maybe theres a built in way

  1. The better way is to use the CocoImage API.

kwcoco.examples.faq.whats_the_difference_between_Images_and_CocoImage()[source]
  1. What is the difference between kwcoco.Images and kwcoco.CocoImage.

It’s a little weird because it grew organically, but the “vectorized API” calls like .images, .annots, .videos are methods for handling multiple dictionaries at once. E.g. dset.images().lookup(‘width’) returns a list of the width attribute for each dictionary that particular Images object is indexing (which by default is all of them, although you can filter).

In contrast the kwcoco.CocoImage object is for working with exactly one image. The important thing to note is if you have a CocoImage coco_img = dset.coco_image(1) The coco_img.img attribute is exactly the underlying dictionary. So you are never too far away from it.

Similarly for the Images objects: dset.images().objs returns a list of all of the image dictionaries in that set.