Skip to main content

Utility to create image datasets from feed of webcam or Video file

Project description

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>

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

mkdataset-0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

mkdataset-0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file mkdataset-0.1.tar.gz.

File metadata

  • Download URL: mkdataset-0.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for mkdataset-0.1.tar.gz
Algorithm Hash digest
SHA256 b0c4bf3230c797bb951477a7a23cbfcee934d10dd5129d5a7f84585eb1c852b8
MD5 a3f3149541266fed2799e7575fbaf1f3
BLAKE2b-256 34d535cb48d558fe22010473846c49a4be0e8ddb87395b8083368ca57091aeee

See more details on using hashes here.

File details

Details for the file mkdataset-0.1-py3-none-any.whl.

File metadata

  • Download URL: mkdataset-0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for mkdataset-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5782af323fdcffdd09a8a4e7d28dcf9842824d9f8d803e51bde1a7b9add5f9a5
MD5 b4831d67d6ac2ebcbe7a7581e2e5a272
BLAKE2b-256 592d7a7c70be29ca9a28d889d61dfa2b67aecacfa7e88edf6a1c54ec76f00652

See more details on using hashes here.

Supported by

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