Skip to main content

A Moving MNIST dataset generator for object detection tasks.

Project description

Detection Moving MNIST Dataset

Version Easy

Detection Moving MNIST Dataset (Easy) annotated video 1 Detection Moving MNIST Dataset (Easy) annotated video 2 Detection Moving MNIST Dataset (Easy) annotated video 3

Version Medium

annotated_video_medium_cp_3.gif annotated_video_medium_cp_3.gif annotated_video_medium_cp_3.gif annotated_video_medium_cp_3.gif annotated_video_medium_cp_3.gif annotated_video_medium_cp_3.gif annotated_video_medium_cp_3.gif annotated_video_medium_cp_3.gif annotated_video_medium_cp_3.gif annotated_video_medium_cp_3.gif

This dataset extends the original Moving MNIST dataset. A few variations on how digits move are added.

In this dataset, each frame is padded to have a resolution of image size 128x128. Each frame is also provided with annotations for object detection (center point detection).

Setup repository

conda create -n detection_moving_mnist python=3.11
conda activate detection_moving_mnist
pip install -r requirements.txt

How to generate torch-tensor-format datasets

python3 generate.py -h                    
usage: generate.py [-h] [--version VERSION] [--split SPLIT] [--num_frames_per_video NUM_FRAMES_PER_VIDEO] [--num_videos NUM_VIDEOS] [--num_videos_hard NUM_VIDEOS_HARD] [--whole_dataset] [--seed SEED] [--hf_videofolder_format] [--hf_arrow_format]

Generate Detection MovingMNIST dataset with specified parameters.

options:
  -h, --help            show this help message and exit
  --version VERSION     MMNIST version: easy
  --split SPLIT         Dataset splits: train, test
  --num_frames_per_video NUM_FRAMES_PER_VIDEO
                        Number of frames per video.
  --num_videos NUM_VIDEOS
                        Number of videos.
  --num_videos_hard NUM_VIDEOS_HARD
                        Number of videos hard limit used when whole_dataset is set.
  --whole_dataset       We make sure all MNIST digits are used for the dataset.
  --seed SEED           Seed.
  --hf_videofolder_format
                        Save in Hugging Face video folder format.
  --hf_arrow_format     Save in Hugging Face arrow format.

Example:

python3 generate.py --split train --version easy --num_frames_per_video 20 --num_videos 60000 --num_videos_hard 120000 --whole_dataset --hf_arrow_format

How to convert torch-tensor-format to huggingface videofolder format

python3 to_video.py -h                                                                                         
usage: to_video.py [-h] [--version VERSION] [--split SPLIT] [--in_place]

Convert torch-tensor-format to huggingface videofolder format.

options:
  -h, --help         show this help message and exit
  --version VERSION  MMNIST version: easy, medium, hard, random
  --split SPLIT      Dataset splits: train, test
  --in_place         Remove source files during conversion to save space

Example:

python3 to_video.py --version easy --split test

Video conversion uses a rate of 10 frames per second. This can be adjusted in src/utils/utils.py.

How to calculate dataset statistics (huggingface arrow format).

Important this script supports only huggingface videofolder format.

python3 calculate_dataset_statistics.py -h
usage: calculate_dataset_statistics.py [-h] --dataset_dir DATASET_DIR [--splits SPLITS [SPLITS ...]]

Calculate dataset statistics and create distribution histograms

options:
  -h, --help            show this help message and exit
  --dataset_dir DATASET_DIR
                        Root directory of dataset in Hugging Face videofolder format
  --splits SPLITS [SPLITS ...]
                        Dataset splits to process (e.g., train,test)

Example:

python3 calculate_dataset_statistics.py --dataset_dir mmnist-dataset/huggingface-arrow-format/mmnist-easy

Acknowledgements

This project is based on and modified from the repository:

We extend our gratitude to the original author @YichengShen for their work.

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

detection_moving_mnist-0.4.2.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

detection_moving_mnist-0.4.2-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file detection_moving_mnist-0.4.2.tar.gz.

File metadata

  • Download URL: detection_moving_mnist-0.4.2.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for detection_moving_mnist-0.4.2.tar.gz
Algorithm Hash digest
SHA256 e6b2984322ac8cec4131d2d1983cef94bb04a5fd92886311f0e8916c190d317b
MD5 2601137a48cad5d9df4e139ff824ed6f
BLAKE2b-256 074085de6c3261b7b940984c63f20493c483fb5066e2b31ccd2ebdaab651c2dc

See more details on using hashes here.

File details

Details for the file detection_moving_mnist-0.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for detection_moving_mnist-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2c83310d0c2228770517bf2c6fdbb61e738a873dbbbdf621b4c3bdc92f4113c0
MD5 016abd0bfcc9151f90cf93b1e65a4850
BLAKE2b-256 2c73ba9d72f41ef8470bcc0bd335fdca676a7541eb8b41e89561e5efbbceeb42

See more details on using hashes here.

Supported by

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