Skip to main content

A Moving MNIST dataset generator for object detection tasks.

Project description

Detection Moving MNIST Dataset

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

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.3.1.tar.gz (14.1 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.3.1-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: detection_moving_mnist-0.3.1.tar.gz
  • Upload date:
  • Size: 14.1 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.3.1.tar.gz
Algorithm Hash digest
SHA256 3125e5e7820fb7d65fb94507ee638c2af261abd54801735adb02ec1f844a4b0b
MD5 815bfce62c3e2cd6edf2a06c5efe256a
BLAKE2b-256 ef51115c435dfb2db3d8e3ee51754f9dc9da4ee8860b20957d15a321dcee3f24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for detection_moving_mnist-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f9745ab9e261b20d84764a34761aaeeddd3669cfae5a504e2e72b56b24314275
MD5 a15a5fae996fda60447aac73152800bc
BLAKE2b-256 35fa90cc9a47738d2411adff2d5d066e4a996a08cb03fc7f30a8bce7ce9689f7

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