Skip to main content

A small package to ease working with the YCB-Video dataset

Project description

ycbvideo

Python package for loading the data from the YCB-Video Dataset. It's a very large dataset made for computer vision task like 6D object pose estimation or semantic segmentation. You can find more information and a download link for the dataset here.

It allows access to the frames, located either in data or the data_syn folders. A frame here corresponds to all the information available for one portion of time, i.e. not only the color image, but the color/depth/label images and for the frames in data also the bounding box coordinates. Frames are grouped in frame sequences of consecutive frames. Frames and frame sequences can be specified by frame selection expressions.

Example:

Frame 42 from frame sequence 7 corresponds to the following data

  • data/0007/000042-color.png
  • data/0007/000042-depth.png
  • data/0007/000042-label.png
  • data/0007/000042-box.txt

and can be specified by the frame selection expression 7/42 to just specify this single frame. If you'd like to specify e.g. the 42th frame for each available frame sequence, you could express this by */42. If you're interested in only the 42th frame from the frame sequences 7, 10 and 17, you'd use [7,10,17]/42. You can provide multiple of these expressions and receive the frames in the order of your expressions. Have a look at the documentation for the YCBVideoLoader.frames() method for more ways and examples of how to specify the frames you're interested in.

The data_syn directory is also handled as a frame sequence, */42 therefore would also include the 42th frame from the data_syn frame sequence.

Because the dataset is huge (~273 GB), it wouldn't make much sense to load all the data into memory at once, therefore, frames are loaded one at a time. Especially in case your working with just a subset of all the data from the dataset, e.g. having only the frame sequences 0001 - 0010 on your disk, you'd want to be sure that the data is really available when you start working with the frames. Therefore, after you specify all the frames you need by frame selection expression(s), an automatic check is made to ensure that all the frames are on your disk and you didn't forget to put e.g. frame sequence 0010 on your disk. This is especially helpful since the dataset is of most use for machine learning tasks. Getting a "file not found" error after hours of training could be very frustrating.

By running

python -m ycbvideo /path/to/data

you can manually inspect and check the integrity of the portion of the dataset on your disk.

Installation

It's published at PYPI, just use pip install ycbvideo to install it. Python >= 3.8 is required.

Usage

First, import the package and create a loader. Provide the path to the dataset directory. Do not modify the data afterwards!

import ycbvideo

loader = ycbvideo.YCBVideoLoader('/path/to/data')

Accessing Frames

You can specify the frames by frame selection expressions, either via a list of such expressions or by providing a file comprised of those expressions, one expression per line.

  • Via a list

    for frame in loader.frames(['data_syn/1', '[1]/[2,4,5]', 'data_syn/[3,4]', '[2,3,4]/*', '*/*'):
        // do something with the frame
    
  • Via a file

    # frames.txt
    
    data_syn/1
    [1]/[2,4,5]
    data_syn/[3,4]
    [2,3,4]/*
    */*
    
    for frame in loader.frames('/path/to/frames.txt'):
        // do something with the frame
    

    If you provide a relative path, it is assumed that the file is located inside the dataset directory, e.g. imagesets/train.txt.

If you want the frames to be shuffled for e.g. training in machine learning, just set the corresponding keyword argument to True. Optionally, you can set a seed to get the same shuffling result for each run:

# setting the seed
random.seed(42)

for frame in loader.frames('imagesets/train.txt', shuffle=True):
    // do something with it

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ycbvideo-0.2.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

ycbvideo-0.2.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file ycbvideo-0.2.0.tar.gz.

File metadata

  • Download URL: ycbvideo-0.2.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for ycbvideo-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1bfc7e957f1e8c2b29f938c1b7b6daf322cfb8cd9b740c8f473d5a3d612d05fe
MD5 c9f251f16cd8a253498e70e2281a6a85
BLAKE2b-256 8fb93c03b5bb304b6191152e6a4cb41f8213364ebada1efcd61085453c2c6f43

See more details on using hashes here.

File details

Details for the file ycbvideo-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ycbvideo-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for ycbvideo-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68c8fd8b76c8302f87afebbfe4f48be43942f067e8e945ac4283f144730e3805
MD5 de44b834a77bf52159ac2fcdaa1f6abd
BLAKE2b-256 38ad75df6d1ed05946ffca86d78989e735ebdd69145cba149b2be40d2c8ab2ae

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page