Skip to main content

saveimg

Command line utility to create image datasets from webcam feed or from Video files.

Installation

  • Install from pip using pip install mkdataset

  • Clone the repo and install using python setup.py install


Usage:

(save) D:\venvs\saveimg>saveimg
Usage: saveimg [OPTIONS] NAME
Try "saveimg --help" for help.

Error: Missing argument "NAME".

(save) D:\venvs\saveimg>saveimg --help
Usage: saveimg [OPTIONS] NAME

  Capture frame from video feed at set intervals and save them as an
  organized dataset with  images in training, test and validation folders

  Currently supports only for one class name

Options:
  -d, --directory PATH            Directory where images has to be saved,
                                  expects path not string
  -v, --video FILENAME            Video file to parse, default is webCam feed
  -s, --fps INTEGER               Capture rate in seconds per Frame
  -p, --distribution <FLOAT FLOAT FLOAT>...
                                  Distribution of train, test and valid images
                                  to be saved
  -c, --cont BOOLEAN              If train, test and validation images should
                                  have continuity in naming
  -r, --reverse BOOLEAN           If train, test and validation should be
                                  inside class folder unlike class folder
                                  inside these
  --help                          Show this message and exit.

(save) D:\venvs\saveimg>

(save) D:\venvs\saveimg>saveimg test_class
---------------------------------------------------------------------------------
        Directory is D:\venvs\saveimg

        Saving image every 1 seconds

        Saving train, test and validation in ratio of (0.6, 0.2, 0.2)

        Reading video feed from Webcam
---------------------------------------------------------------------------------
Please enter to proceed :  [True]: n


(save) D:\venvs\saveimg>saveimg test_class
---------------------------------------------------------------------------------
        Directory is D:\venvs\saveimg

        Saving image every 1 seconds

        Saving train, test and validation in ratio of (0.6, 0.2, 0.2)

        Reading video feed from Webcam
---------------------------------------------------------------------------------
Please enter to proceed :  [True]: y
Saved D:\venvs\saveimg\train\test_class\test_class_1.jpg
---------
Saved D:\venvs\saveimg\train\test_class\test_class_2.jpg
---------
Saved D:\venvs\saveimg\train\test_class\test_class_3.jpg
---------
Saved D:\venvs\saveimg\validation\test_class\test_class_1.jpg
---------
Saved D:\venvs\saveimg\train\test_class\test_class_4.jpg
---------
Saved D:\venvs\saveimg\train\test_class\test_class_5.jpg
---------
Saved D:\venvs\saveimg\train\test_class\test_class_6.jpg
---------
Saved D:\venvs\saveimg\validation\test_class\test_class_2.jpg
---------
Saved D:\venvs\saveimg\train\test_class\test_class_7.jpg

Aborted!
[ WARN:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (674) SourceReaderCB::~SourceReaderCB terminating async callback

(save) D:\venvs\saveimg>


(save) D:\venvs\saveimg>saveimg -d D:\venvs -p 0.7 0.15 0.15 label1
---------------------------------------------------------------------------------
        Directory is D:\venvs

        Saving image every 1 seconds

        Saving train, test and validation in ratio of (0.7, 0.15, 0.15)

        Reading video feed from Webcam
---------------------------------------------------------------------------------
Please enter to proceed :  [True]: n

Notice that image numbers are continuous

(save) D:\venvs\saveimg>saveimg -d D:\venvs -p 0.4 0.3 0.3 -c y label
---------------------------------------------------------------------------------
        Directory is D:\venvs

        Saving image every 1 seconds

        Saving train, test and validation in ratio of (0.4, 0.3, 0.3)

        Reading video feed from Webcam
---------------------------------------------------------------------------------
Please enter to proceed :  [True]:
Saved D:\venvs\train\label\label_0.jpg
---------
Saved D:\venvs\train\label\label_1.jpg
---------
Saved D:\venvs\train\label\label_2.jpg
---------
Saved D:\venvs\train\label\label_3.jpg
---------
Saved D:\venvs\test\label\label_4.jpg
---------
Saved D:\venvs\train\label\label_5.jpg
---------
Saved D:\venvs\validation\label\label_6.jpg
---------
Saved D:\venvs\train\label\label_7.jpg
---------
Saved D:\venvs\test\label\label_8.jpg
---------
Saved D:\venvs\train\label\label_9.jpg
---------
Saved D:\venvs\train\label\label_10.jpg
---------
Saved D:\venvs\validation\label\label_11.jpg
---------
Saved D:\venvs\test\label\label_12.jpg
---------
Saved D:\venvs\validation\label\label_13.jpg

Aborted!
[ WARN:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (674) SourceReaderCB::~SourceReaderCB terminating async callback

(save) D:\venvs\saveimg>

Train, test and validation inside image_label folder

(save) D:\venvs\saveimg>saveimg -d D:\venvs -p 0.4 0.3 0.3 -r y image_label
---------------------------------------------------------------------------------
        Directory is D:\venvs

        Saving image every 1 seconds

        Saving train, test and validation in ratio of (0.4, 0.3, 0.3)

        Reading video feed from Webcam
---------------------------------------------------------------------------------
Please enter to proceed :  [True]:
Saved D:\venvs\image_label\validation\image_label_1.jpg
---------
Saved D:\venvs\image_label\train\image_label_1.jpg
---------
Saved D:\venvs\image_label\validation\image_label_2.jpg
---------
Saved D:\venvs\image_label\validation\image_label_3.jpg
---------
Saved D:\venvs\image_label\test\image_label_1.jpg
---------
Saved D:\venvs\image_label\test\image_label_2.jpg
---------
Saved D:\venvs\image_label\validation\image_label_4.jpg

Aborted!
[ WARN:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (674) SourceReaderCB::~SourceReaderCB terminating async callback

(save) D:\venvs\saveimg>

Metadata

Release files for mkdataset 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mkdataset 0.1
File Size Uploaded
mkdataset-0.1.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mkdataset 0.1
File Interpreter ABI Platform
mkdataset-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / mkdataset-0.1.tar.gz

Download URL mkdataset-0.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b0c4bf3230c797bb951477a7a23cbfcee934d10dd5129d5a7f84585eb1c852b8
BLAKE2b-256 checksum
How to use checksums
34d535cb48d558fe22010473846c49a4be0e8ddb87395b8083368ca57091aeee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.4

Release files / mkdataset-0.1-py3-none-any.whl

Download URL mkdataset-0.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5782af323fdcffdd09a8a4e7d28dcf9842824d9f8d803e51bde1a7b9add5f9a5
BLAKE2b-256 checksum
How to use checksums
592d7a7c70be29ca9a28d889d61dfa2b67aecacfa7e88edf6a1c54ec76f00652
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.4

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page