2D Geometric Shapes Dataset - For Machine Learning and Patte - 2020 - Data in BR
2D Geometric Shapes Dataset - For Machine Learning and Patte - 2020 - Data in BR
2D Geometric Shapes Dataset - For Machine Learning and Patte - 2020 - Data in BR
Data in Brief
Data Article
a r t i c l e i n f o a b s t r a c t
∗
Corresponding authors.
E-mail addresses: anaselkorchi@gmail.com (A.E. Korchi), youssefghanou@yahoo.fr (Y. Ghanou).
https://doi.org/10.1016/j.dib.2020.106090
2352-3409/© 2020 The Author(s). Published by Elsevier Inc. This is an open access article under the CC BY license.
(http://creativecommons.org/licenses/by/4.0/)
2 A.E. Korchi and Y. Ghanou / Data in Brief 32 (2020) 106090
Specifications Table
• The simulated dataset can be used to train machine learning models to perform geometric
shape recognition tasks.
• This dataset could be useful for researchers studying the overfitting of machine learning
models [2] since the classification of the images inside this dataset can only be performed
with a model that focuses on pattern detection [1] instead of memorization.
• This dataset could be useful for researchers to benchmark and test any regularization tech-
niques that can be applied to machine learning models or any other approach that can help
to avoid the overfitting.
• This dataset consists of a set of images containing random drawn geometrical shapes, which
provides a clean dataset from any data leak that would influence the benchmark of any ma-
chine learning model.
1. Data Description
The presented dataset is a set of 90k RGB images of a fixed resolution 200 × 200 pixel. This
specific resolution aims to provide the minimum space where we can draw the geometric
shapes with different positions and different sizes inside the image. Taking into consideration
that high-resolution images require more computation power for machine learning models dur-
ing the training phase, which may make the published dataset less useful as a benchmarking
dataset. Each image contains one of the following polygon shapes: Triangles, Squares, Pentagons,
Hexagons, Heptagons, Octagons, Nonagons, Circles and Stars. 10k images were generated for each
shape (Fig. 1). Each image is saved in a PNG file. The name of each file is composed of two sec-
tions: [Type of polygon shape drawn inside the image]_[UUID].png.
A.E. Korchi and Y. Ghanou / Data in Brief 32 (2020) 106090 3
Fig. 1. CNN architecture used for recognition and classification of geometric shapes. Conv 2D + BN denotes a convolu-
tional layer with Batch Normalization [3].
Examples:
• Triangle_6f1d8142–2a58–11ea-8f1b-c869cd928de6.png
• Square_6f22e600–2a58–11ea-a950-c869cd928de6.png
• Pentagon_6f22e998–2a58–11ea-9fc2-c869cd928de6.png
• Hexagon_6f22eb64–2a58–11ea-818b-c869cd928de6.png
• Heptagon_6f22ecd8–2a58–11ea-82eb-c869cd928de6.png
• Octagon_6f22f118–2a58–11ea-944f-c869cd928de6.png
• Nonagon_6f22f318–2a58–11ea-bf89-c869cd928de6.png
• Circle_6f22f4d8–2a58–11ea-beb7-c869cd928de6.png
• Star_6f22f654–2a58–11ea-b6fc-c869cd928de6.png
The background colour of each image, the filling colour of each shape, the rotation angle of
each shape, the position of each shape inside the image, as well the perimeter of each shape is
generated randomly and independently.
The generation program was developed using the Python programming language and the Tur-
tle library to draw geometric shapes inside each image as well we have used the NumPy library
to generate all the random parameters that we have used during the generation. The generation
program receives as an input the number of desired samples per each shape as well as the path
of the storage directory where the generated images will be stored. The goal of the tool is to
generate a set of labelled images that contains 2D geometric shapes.
Each image is generated with the following parameters:
Table 1
Statistical description of the generated dataset.
ignore the very low probability that the background colour would be the same as the filling
colour).
• A random rotation angle between -180° and 180°
• A random shape perimeter
• A random shape position inside the containing image
The perimeter and the position of each shape inside each image are selected as the following.
• First, we select the radius of the circumscribed circle of the drawn shape randomly, and
this selection is performed within the interval of 10 and 75 (pixels), which ensures that the
drawn shape may have a random perimeter between the interval of 10 and 75. Also, it gives
that the smallest possible shape may be circumscribed by a circle with a radius = 10 pixel,
and the largest possible shape may be circumscribed by a circle with a radius = 75 pixel. In
Table 1 we show the minimal possible perimeter of each shape the maximal possible perime-
ter for each shape, the minimal possible area of each shape and the maximal possible area
of each shape based on the parameters described above.
• Then, in the function of the selected radius value, we choose the position of the centre of the
circumscribed circle of the drawn shape inside the image randomly, the position is selected
under the condition that all the drawn shape must be fully visible inside the image.
• And finally, we draw the shape in the function of the centre and position of its circumscribed
circle. Note that the circumscribed circle of the shape is used only to draw the shapes, and
it is not visible in the generated images (Fig. 2).
All the parameters described above are generated for each sample independently and identi-
cally. All the random values are selected by using the Numpy function numpy.random.randInt,
which generates a defined number of random values from the uniform discrete distribution in
the half-open interval specified in the function call arguments.
This dataset could be used to train a convolutional neural network to perform geometric
shape recognition and classification. To do so, this dataset must be divided into two separate
sets of data a training dataset and a testing dataset, the selection of samples that composes
each collection of data is made randomly:
The architecture of the convolutional neural network is defined as the following: 7 convo-
lutional layers and one fully connected layer, which represents the output layer of the neural
network. Each convolutional layers is illustrated with a parametrized number of filters a batch
A.E. Korchi and Y. Ghanou / Data in Brief 32 (2020) 106090 5
Fig. 2. Samples from the generated dataset, each row contains examples that belong to the same geometric shape.
normalization layer [3] an activation function, and a max-pooling layer follows each convolu-
tional layer. Fig. 1 shows the convolutional neural network architecture that can be used on this
dataset.
The authors declare that they have no known competing financial interests or personal rela-
tionships which have, or could be perceived to have, influenced the work reported in this article.
References
[1] M.Douglas Hawkins, The problem of overfitting, J. Chem. Inf. Comput. Sci. 44 (2004) 1–12.
[2] M Bishop, Christopher, Pattern recognition and Machine Learning, Springer, 2006.
[3] S. Ioffe, C. Szegedy, Batch normalization: accelerating deep network training by reducing internal covariate shift, in:
Proceedings of the 32nd International Conference on Machine Learning, Lille, France, ICML, 2015, pp. 448–456. 6-11
July 2015, 2015.