令和元年度電気関係学会四国⽀部連合⼤会 講演論⽂集 (2019 新居浜⾼専)
2019 SHIKOKU-SECTION JOINT CONVENTION RECORD OF THE INSTITUTES OF ELECTRICAL AND RELATED ENGINEERS (NIIHAMA)

1-13
Building Data Sets Using k-Means Clustering andInvestigation of Training Accuracy in Convolutional Neural Networks
Yuichi MIYATA

Yoko UWATE Yoshifumi NISHIO( Tokushima University)

1. Introduction
In recent years, aerial photography became easierthan before by using the camera loaded in a drone.
Also, convolutional neural network (CNN) is one ofdeep learning and is the network often used for image
recognition. With the development of CNN, drones arebeing researched for applications in various fields suchas agriculture. Actually, wild animals such as deerand boars are rapidly increasing in Japanese forests.
Agricultural crops damaged in nearby farms. By using a drone, we expected to wild animals management.
However, the drone camera’s battery and memory arelimited. It is important to use the collected data eﬀectively.
In this study, we used clustering to make more eﬃcient data sets from the collected image data.

[Data set1] : Only before clustering (400 images)[Data set2] : Randomly extracted (200 images)[Data set3] : Cluster A (243 images)[Data set4] : Cluster B (157 images)[Data set5] : Cluster A 50% + Cluster B 50%(200 images)

2. Proposed method
Clustering is a method of classifying data having similar features. Therefore, we can classify images whichhave similar characteristics such as color and shape byusing clustering. This time, we use k-means clustering
to classify the images into two clusters and constructeddata sets. The images for data sets are collected by entering a general name into the search word in the image
search of google. We prepare 400 images for training
and test. There are animals in 200 images among 400images. Other than that, they are images of the background. Furthermore, we convert 3D array of input
image data is converted to a 2D array data.
The flow of learning by k-means clustering and theobjective function are described as follows:f ({Ck }) =k∑∑(xk − xi )2 .

Figure 1: Training accuracy of each data sets.
In Fig. 1, we show the training accuracy and stepof each data set on CNN. Each data sets have diﬀerent number of images. We found that the influenceof training accuracy was small even if there were few
images for learning.
Table 1: Average of training and test accuracies.
Data sets
Training accuracy [%]Test accuracy [%]

1100
96

2
100
88

3
100
96.5

4100
66

5
100
93.5

(1)

k=1 xi ∈Ck

From Table 1, the test accuracy of data set3 is only alittle bit better than the data set1. When we compareddata set2 and data set5, it increased the test accuracyof data set5 with the same number of images.

After making the data sets by k-means clustering, CNN learns them. We define as the learning steps are 300. The learning rate of CNN is0.00001. When it learns by CNN, the input images(432 ×324 pixels) is resized to 28 × 28 pixels.

4. Conclusion
We used k-means clustering to construct data setsthat achieve high accuracy with few images. We classified images into two classes for each feature by k-meansclustering. From these images, we constructed 5 data
sets and trained using CNN. We compared with training accuracy and investigated the eﬀect of clustereddata sets. In simulation results, the proposed method
obtains a little bit better test accuracy than the conventional method.
In future works, we will investigate the eﬀective data
set for learning by increasing the number of clusters.

3. Simulation results
We classified each of the images of the animal andthe images of the background into 2 classes using kmeans clustering. Images of the animal are divided
into 134 and 66 images. Images of the backgroundare divided into 109 and 91 images. One with a large
number of clustered images is referred to as cluster A,
and the other with a small number as cluster B. We
construct the following data set to compare the eﬀects
of clustering.

13