Skip to content

Commit

Permalink
Add basic skills - Level 10: Data Generation (#953)
Browse files Browse the repository at this point in the history
<!-- Contributing guide:
https://github.com/openvinotoolkit/datumaro/blob/develop/CONTRIBUTING.md
-->

### Summary
Ticket no. 107282
Add basic skills - Level 10: Data Generation

<!--
Resolves #111 and #222.
Depends on #1000 (for series of dependent commits).

This PR introduces this capability to make the project better in this
and that.

- Added this feature
- Removed that feature
- Fixed the problem #1234
-->

### How to test
<!-- Describe the testing procedure for reviewers, if changes are
not fully covered by unit tests or manual testing can be complicated.
-->

### Checklist
<!-- Put an 'x' in all the boxes that apply -->
- [ ] I have added unit tests to cover my changes.​
- [ ] I have added integration tests to cover my changes.​
- [ ] I have added the description of my changes into
[CHANGELOG](https://github.com/openvinotoolkit/datumaro/blob/develop/CHANGELOG.md).​
- [x] I have updated the
[documentation](https://github.com/openvinotoolkit/datumaro/tree/develop/docs)
accordingly

### License

- [ ] I submit _my code changes_ under the same [MIT
License](https://github.com/openvinotoolkit/datumaro/blob/develop/LICENSE)
that covers the project.
  Feel free to contact the maintainers if that's a concern.
- [ ] I have updated the license header for each file (see an example
below).

```python
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT
```
  • Loading branch information
bonhunko authored Apr 19, 2023
1 parent d950321 commit 6529b60
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 28 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
===========================
Level 10: Data Generation
===========================


Pre-training of deep learning models for vision tasks can increase model accuracy.
Training model with the synthetic dataset is one of famouse pre-training approach
since the manual annotations is quite expensive work.

Base on the [FractalDB]_,
Datumaro provides a fractal image dataset (FractalDB) generator that can be utilized to pre-train the vision models.
Learning visual features of FractalDB is known to increase the performance of Vision Transformer (ViT) models.
Note that a fractal patterns in FractalDB is calculated mathmatically using the interated function system (IFS) with random parameters.
We thus not need to concern about any privacy issues.


.. tab-set::

.. tab-item:: CLI

We can generate the synthetic images by the following CLI command:

.. code-block:: bash
datum generate -o <path/to/data> --count GEN_IMG_COUNT --shape GEN_IMG_SHAPE
``GEN_IMG_COUNT`` is an integer that indicates the number of images to be generated. (e.g. ``--count 300``)
``GEN_IMG_SHAPE`` is the shape (width height) of generated images (e.g. ``--shape 240 180``)

.. tab-item:: Python

With Pthon API, we can generate the synthetic images as below.

.. code-block:: python
from datumaro.plugins.synthetic_data import FractalImageGenerator
FractalImageGenerator(output_dir=<path/to/data>, count=GEN_IMG_COUNT, shape=GEN_IMG_SHAPE).generate_dataset()
``GEN_IMG_COUNT`` is an integer that indicates the number of images to be generated. (e.g. ``count=300``)
``GEN_IMG_SHAPE`` is a tuple representing the shape of generated images as (width, height) (e.g. ``shape=(240, 180)``)

Congratulations! You complete reading all Datumaro level-up documents for the intermediate skills.

.. [FractalDB] Can Vision Transformers Learn without Natural Images?, Kodai Nakashima, et. al., 2013.

0 comments on commit 6529b60

Please sign in to comment.