Научная статья на тему 'A Convolutional Neural Network For Classification Cotton Boll Opening Degree'

A Convolutional Neural Network For Classification Cotton Boll Opening Degree Текст научной статьи по специальности «Компьютерные и информационные науки»

CC BY
28
5
i Надоели баннеры? Вы всегда можете отключить рекламу.
Ключевые слова
computer vision / convolutional neural network / image classification / image segmentation / recurrent neural networks / model training / epoch / layers / computer vision / convolutional neural network / image classification / image segmentation / recurrent neural networks / model training / epoch / layers

Аннотация научной статьи по компьютерным и информационным наукам, автор научной работы — Uljaev Erkin, Abdulkhamidov Azizjon, Ubaydullayev Utkirjon

The paper is devoted to the development of a cotton boll opening degree classification algorithm based on a convolutional neural network. A neural network consisting of convolutional layers, subsampling layers, and full-link layers was used in the study. The aim of the work is to classify cotton boll samples according to their opening degree. The classification criteria are minimizing the number of errors and achieving high accuracy. In the process of creating the algorithm, the data obtained by computing and image processing software were used. In this paper, a number of experiments were conducted with different parameters of convolutional neural networks and training samples to optimize the classification process. The final algorithm was tested on real cotton samples and demonstrated high classification accuracy.

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

A Convolutional Neural Network For Classification Cotton Boll Opening Degree

The paper is devoted to the development of a cotton boll opening degree classification algorithm based on a convolutional neural network. A neural network consisting of convolutional layers, subsampling layers, and full-link layers was used in the study. The aim of the work is to classify cotton boll samples according to their opening degree. The classification criteria are minimizing the number of errors and achieving high accuracy. In the process of creating the algorithm, the data obtained by computing and image processing software were used. In this paper, a number of experiments were conducted with different parameters of convolutional neural networks and training samples to optimize the classification process. The final algorithm was tested on real cotton samples and demonstrated high classification accuracy.

Текст научной работы на тему «A Convolutional Neural Network For Classification Cotton Boll Opening Degree»

Muhammad al-Xorazmiy nomidagi TATU Farg'ona filiali "Al-Farg'oniy avlodlari" elektron ilmiy jurnali ISSN 2181-4252 Tom: 1 | Son: 4 | 2023-yil

"Descendants of Al-Farghani" electronic scientific journal of Fergana branch of TATU named after Muhammad al-Khorazmi. ISSN 2181-4252 Vol: 1 | Iss: 4 | 2023 year

Электронный научный журнал "Потомки Аль-Фаргани" Ферганского филиала ТАТУ имени Мухаммада аль-Хоразми ISSN 2181-4252 Том: 1 | Выпуск: 4 | 2023 год

A Convolutional Neural Network For Classification Cotton Boll Opening Degree

Erkin Uljaev,

Doctor of Technical Sciences, Department of Information Processing and Management, Professor Tashkent State Technical University named after Islam Karimov

Tashkent, Uzbekistan e.uljaev@mail.ru

Azizjon Abdulkhamidov,

Doctoral Candidate, Department of Information Processing and Management Tashkent State Technical University

named after Islam Karimov Tashkent, Uzbekistan azex_91@mail.ru

Utkirjon Ubaydullayev,

PhD, Department of Information Processing and Management, Associate professor Tashkent State Technical University named after Islam Karimov Tashkent, Uzbekistan utkir2005@gmail.com

Abstract. The paper is devoted to the development of a cotton boll opening degree classification algorithm based on a convolutional neural network. A neural network consisting of convolutional layers, subsampling layers, and full-link layers was used in the study. The aim of the work is to classify cotton boll samples according to their opening degree. The classification criteria are minimizing the number of errors and achieving high accuracy. In the process of creating the algorithm, the data obtained by computing and image processing software were used. In this paper, a number of experiments were conducted with different parameters of convolutional neural networks and training samples to optimize the classification process. The final algorithm was tested on real cotton samples and demonstrated high classification accuracy.

Keywords. computer vision, convolutional neural network, image classification, image segmentation, recurrent neural networks, model training, epoch, layers.

Introduction. To date, one of the most popular mathematical models used in computer vision is the neural network model (Fig. 1), which is based on the work of neurons in the brain, and can be successfully used for object classification and recognition in video images [1].

of pixels into object various distinctive

numerical boundaries. combinations features, language. ofboundaries.

Model of neural networks.

In order to recognize obj ects in the video image, the following steps can be performed. At the first step of detection, the identification of objects in the video image is performed. Object identification is performed using algorithms that analyze the pixels of the image, resulting in the extraction of object contours. The next step is to extract features that will be further used to distinguish one object from another. The differentiation can be done using machine learning algorithms that analyze the shape, color, texture, and other properties of the objects. The next step is to use machine learning algorithms to recognize objects in the video image. This step involves comparing the features extracted from the objects with a database of known

31

"Descendants of Al-Farghani" electronic scientific Электронный научный журнал "Потомки Аль-

journal of Fergana branch of TATU named after Фаргани" Ферганского филиала ТАТУ имени

Muhammad al-Khorazmi. ISSN 2181-4252 Мухаммада аль-Хоразми ISSN 2181-4252

Vol: 1 | Iss: 4 | 2023 year Том: 1 | Выпуск: 4 | 2023 год

Muhammad al-Xorazmiy nomidagi TATU Farg'ona filiali "Al-Farg'oniy avlodlari" elektron ilmiy jurnali ISSN 2181-4252 Tom: 1 | Son: 4 | 2023-yil

objects and determining which object the extracted feature belongs to [2].

After training object recognition, we can classify cotton boll disclosure degree according to their images. For more accurate object recognition, it is necessary to build the algorithms according to the specific application and perform tuning of the following algorithm parameters: object detection threshold; object size, and shape.

Image classification is one of the machine learning techniques in which a computer recognizes and classifies images for the presence of certain objects or scenes. It is a process in which a computer model is trained in advance to classify images into specific categories based on a set of criteria that have been defined in advance. Typically, neural networks such as Convolutional Neural Networks (CNN) are often used for image classification, which is able to extract image features and use them for accurate classification [3]. Nowadays, image classification applications are widely used in various fields such as medicine, biology, geographic survey processing, vehicle license plate number detection, automatic face recognition, etc. Applying these methods for the classification of cotton boll opening degrees gives high-accuracy results.

Solution method. To achieve the objective, it is necessary to collect a dataset of cotton bolls' image with 3 different disclosure rate containing, as shown in Fig. 2, captured with a video camera in a cotton field, under different weather conditions and time periods [4-

a. b. c.

Dataset of cotton bolls' image with 3 different disclosure rate: a) - high cotton boll disclosure rate, b) - medium cotton boll disclosure rate, and c) - low cotton boll disclosure rate.

The dataset contains images of cotton bolls in several states and at different stages of cotton opening. Classification of images in the dataset can be done using machine learning and neural networks [11-13].

Let us list the most popular methods of image classification with the possibility of their application to the classification of cotton boll opening degrees:

ГГ

• 1. Binary classification - it can be used to divide

cotton images into two categories (e.g. high cotton boll disclosure and low cotton boll disclosure).

• 2. Multi-class classification - it can be used to

divide the images into multiple categories (e.g. high cotton boll disclosure, medium cotton disclosure, and low cotton boll disclosure).

• 3. Image segmentation - it can be used to divide

an image into several areas according to their features (e.g. cotton without leaves, cotton with leaves, cotton with flowers, etc.). To perform image classification in a software environment can be used various machine learning and neural network methods such as convolutional neural network (CNN) or recurrent neural network (RNN). These methods have high accuracy in image classification and are widely used in various fields including agriculture. CNN [14] was chosen as the machine-learning algorithm for cotton boll opening degree.

A Convolutional Neural Network is a type of neural network that is the main tool for image classification and video processing tasks. The basic idea of CNN is to use convolutional layers that perform an image convolution operation with filters to extract important features of an image [15].

These features are then processed in full convolutional layers that provide efficient image classification based on the extracted features. The filters in convolutional layers are defined by neurons that store the weights of the extracted features. The main advantages of CNNs are:

• high-quality image classification;

• high learning speed due to the use of convolution;

• are robust to changes in scale and rotation of image positions;

• can automatically extract meaningful features from images, which facilitates the learning process [16].

Thus it can be considered that CNNs are the basis for many applications such as automatic face recognition, automatic vehicle license plate number recognition, medical image processing, and cotton boll opening degree recognition.

Methods for solving problem. Classification by cotton boll opening degree can be performed using a convolutional neural network. However, to create such a model, it is necessary to have data that contain

31

Muhammad al-Xorazmiy nomidagi TATU Farg'ona filiali "Al-Farg'oniy avlodlari" elektron ilmiy jurnali ISSN 2181-4252 Tom: 1 | Son: 4 | 2023-yil

"Descendants of Al-Farghani" electronic scientific journal of Fergana branch of TATU named after Muhammad al-Khorazmi. ISSN 2181-4252 Vol: 1 | Iss: 4 | 2023 year

Электронный научный журнал "Потомки Аль-Фаргани" Ферганского филиала ТАТУ имени Мухаммада аль-Хоразми ISSN 2181-4252 Том: 1 | Выпуск: 4 | 2023 год

information about the degree of cotton opening in the images [17].

The idea is to be able to use convolutional layers to learn features related to the degree of cotton disclosure in an image. Then, once the features are extracted, they are processed in full convolutional layers to classify the image into three categories: low cotton boll disclosure, medium cotton boll disclosure, and high cotton boll disclosure [18].

To create such a model, it is necessary to have a large enough dataset to train and test the model. The training set should contain images with different levels of cotton boll opening, as well as labels that indicate the appropriate category.

The model is then trained, in which it uses images from the training set to learn the attributes associated with cotton boll opening level. Once the model is trained, a test dataset can be used to verify its accuracy.

Thus, convolutional neural networks can be used to classify images based on the degree of cotton boll opening. As mentioned above, to create such a model it is necessary to have a large data set for training and testing the model, as well as for training the model on a sufficiently large number of epochs. This makes it possible to extract all the necessary features of images [19-22].

Below is a fragment of the trained model without data in Keras.h5 format. In this case, the code fragments were used to classify cotton bolls by their opening degree.

from keras.models import loadmodel

# TensorFlow is required for Keras to work. import cv2

# Install opencv-python import numpy as np

# Disable exponential representation for clarity np.set_printoptions(suppress=True)

# Download the model

model = load_model("keras_Model.h5", compile = False)

# Download labels

classnames = open("labels.txt",

"r").readlines()

# CAMERA can be 0 or 1 depending on your computer's default camera

camera = cv2.VideoCapture(0) while True:

# Display the image from the camcorder

ret, image = camera.read()

# Resize the raw image to (224 height, 224 width) pixels

image = cv2.resize(image, (224, 224), interpolation=cv2.INTER_AREA)

# Show image in a window cv2.imshow("Webcam Image", image)

# Carry out image corrections with the numpy array and change its shape to the input shape of the model

image = np.asarray(image,

dtype=np.float32).reshape(1, 224, 224, 3)

# Normalization of image array image = (image /127.5) - 1

# Predicts the model

prediction = model.predict(image) index = np.argmax(prediction) classname = class_names[index] confidencescore = prediction[0][index]

# Forecast display and confidence indicator print("Class:", class_name[2:], end="") print("Confidence Score:",

str(np.round(confidence_score * 100))[:-2], "%")

# Monitor keyboard presses

keyboardinput = cv2.waitKey(1)

# Esc keys on the keyboard for interruption if keyboardinput == 27:

break camera.release() cv2.destroyAllWindows()

Thus, in this example, a CNN using Keras library and TensorFlow is applied to perform cotton boll classification according to its opening degree.

Results and discussions. To obtain information about the per-class accuracy, confusion matrix, per-epoch accuracy, and per-epoch loss during model training, various functions and methods from the TensorFlow library can be used.

For example, to get the accuracy per class, can be used the classification_report method from the sklearn.metrics module The report result is shown in Table 1.

Example of use: python

from sklearn.metrics import

classificationreport

# Obtain model predictions on the test sample y_pred = model.predict(testdata)

32

Muhammad al-Xorazmiy nomidagi TATU Farg'ona filiali "Al-Farg'oniy avlodlari" elektron ilmiy jurnali ISSN 2181-4252 Tom: 1 | Son: 4 | 2023-yil

"Descendants of Al-Farghani" electronic scientific journal of Fergana branch of TATU named after Muhammad al-Khorazmi. ISSN 2181-4252 Vol: 1 | Iss: 4 | 2023 year

Электронный научный журнал "Потомки Аль-Фаргани" Ферганского филиала ТАТУ имени Мухаммада аль-Хоразми ISSN 2181-4252 Том: 1 | Выпуск: 4 | 2023 год

# Round values to integers

y_pred = np.argmax(y_pred, axis=1)

# Receive a report on classification accuracy targetnames = ['classV, 'class2', ..., 'classN'] print(classification_report(test_labels, y_pred,

target_names=target_names))

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

Table 1. Classification accuracy report

Accuracy per class

CLASS ACCURACY SAMPLES

High

cotton

boll 1.00 61

disclosure

rate

Medium

cotton

boll 1.00 64

disclosure

rate

Low

cotton

boll 1.00 57

disclosure

rate

confusion_matrix method can be used from the sklearn.metrics module to obtain the confusion matrix (Figure 3).

Example of use:

python

from sklearn.metrics import confusionmatrix

# Obtain the confusion matrix

matrix = confusion_matrix(test_labels, y_pred)

print(matrix)

Confusion matrix

High cotton boll disclosure rate

in Medium cotton H boll disclosure rate

Low cotton boll disclosure rate

0

9 (LI "o iJ

fin "K

° 5

S 3 "S3

| J | I

1 -1 J tj Predication

Confusion matrix.

To obtain sufficient accuracy (Fig. 4) and loss (Fig. 5) at each epoch, can be used the "callbacks" parameter in the "fit" method when training the model. For example, "History" class can be used from the TensorFlow library to store metrics for each epoch.

Example usage:

python

from tensorflow.keras.callbacks import History

# Create an instance of the «History» class to save metrics

history = History()

# Train the model by passing a "History" object to the "callbacks"parameter

model.fit(train_data, trainlabels, epochs=10, validation_data=(test_data, testlabels),

callbacks=[history])

# Get the values of the metrics for each epoch

acc = history.history['accuracy']

valacc = history.history['val_accuracy']

print('Accuracy for every epoch:', acc, val acc)

33

Muhammad al-Xorazmiy nomidagi TATU Farg'ona filiali "Al-Farg'oniy avlodlari" elektron ilmiy jurnali ISSN 2181-4252 Tom: 1 I Son: 4 I 2023-yil

"Descendants of Al-Farghani" electronic scientific journal of Fergana branch of TATU named after Muhammad al-Khorazmi. ISSN 2181-4252 Vol: 1 | Iss: 4 | 2023 year

Электронный научный журнал "Потомки Аль-Фаргани" Ферганского филиала ТАТУ имени Мухаммада аль-Хоразми ISSN 2181-4252 Том: 1 | Выпуск: 4 | 2023 год

Graph of accuracy at epochs. loss = history.history['loss'] valloss = history.history['val_loss']

print('Losses for each epoch:', loss, vol loss)

Loss for every epoch

о J

0,5 0,4 0,3 0,2 0,1

10

20

» Loss

30 40

Epochs

^^ Test loss

50

Graph of loss on epochs.

Here, we used the validation_data parameter to pass the test sample and validate the accuracy and loss at each epoch. The metrics at each epoch are stored in the 'history' object and can be retrieved using the keys 'accuracy', 'val_accuracy', 'loss' and 'val_loss' [21,23-26].

Conclusion. This paper presented a convolutional neural network usage for classification cotton bolls according to their opening degree. The network was trained on a dataset consisting of cotton ball images divided into three categories of opening degree. The classification accuracy report showed that the network presented is reasonably high accuracy in classifying cotton. The plots of accuracy and loss at each epoch show that the network achieves the best

accuracy at the last experiments and that the loss values start decreasing with each epoch. A confusion matrix was also presented, which shows classes those were correctly and incorrectly recognized by the network. As the confusion matrix shows, the most difficult image to classify is the medium-disclosure cotton boll image, which can be confused with the low-disclosure cotton boll image. Thus, the convolutional neural network presented in this paper has shown good results in classifying cotton bolls based on the degree of opening. This technology can be used to control and regulate the technological parameters of cotton-picking machines to increase the yield and speed up the process of harvesting.

References

Surnina Anastasia Olegovna (2017). Elements of global optimization of neural network models. Academy, (3 (18)), 32-36.

Anokhin, M. A. (2014). A method for recognizing moving objects from their video images. East European Journal of Advanced Technologies, 4 (9 (70)), 33-37.

Rogal Andrei Alexandrovich (2016). Application of deep learning methods in the task of image recognition. IN SITU, (6), 13-17.

Uljaev E., Abdulhamidov A. Review of cotton recognition in the field for cotton harvester based on machine vision, Collection of the Republican Scientific and Practical Conference on "Digital technologies: solutions and problems of practical implementation in spheres" Tashkent University of Information Technology named after Muhammad al-Khorazmi Tashkent, April 27-28, 2022 - year, pp. 182-185.

Uljaev E., Abdulhamidov A. To the question of choosing a camera for recognizing raw cotton. Collection of scientific articles of XXVI International Scientific and Practical Conference "Innovation-2022", Tashkent State Technical University. Center for Strategic Innovation and Informatization, pp. 255-257.

Uljaev, E., Ubaydullaev, U., & Abdulhamidov, A. (2021). Selection of methods and sensors for controlling width change between moving objects. InterConf, (56).

Kh, S. I., Porubay, O. V., Lazareva, M. V., & Abdulkhamidov, A. A. (2020). Trends in the development of intelligent systems when making management decisions in Uzbekistan. International scientific journal" Universum: technical sciences, 2(71), 10-14.

34

Muhammad al-Xorazmiy nomidagi TATU Farg'ona filiali "Al-Farg'oniy avlodlari" elektron ilmiy jurnali ISSN 2181-4252 Tom: 1 | Son: 4 | 2023-yil

"Descendants of Al-Farghani" electronic scientific journal of Fergana branch of TATU named after Muhammad al-Khorazmi. ISSN 2181-4252 Vol: 1 | Iss: 4 | 2023 year

Электронный научный журнал "Потомки Аль-Фаргани" Ферганского филиала ТАТУ имени Мухаммада аль-Хоразми ISSN 2181-4252 Том: 1 | Выпуск: 4 | 2023 год

Uljaev E., Ubaydullaev U., Abdulhamidov A., & Narzullaev Sh. (2022). Synthesis of optimal design of a device for control and regulation of working gaps of plucking apparatus of cotton picking machine with vertical spindle. ICoRSE, (564) 116-124.

Uljaev, E., Ubaydullaev, U., & Abdulhamidov, A. (2021). Analysis of the current state of automation of control and regulation of the working slit width of the harvesting unit of a cotton picker with a vertical spindle. InterConf, (48).

Uljaev E., Abdulhamidov A. Measurement of cotton bush width with application of technical vision and mathematical justification, Scientific and Technical Journal of Fergana Polytechnic Institute, 2023 Special Issue No. 2, pp. 248-251.

Abdulhamidov A., Uljaev E. Determination of cotton raw material openness degree with the help of technical vision. Registered in the State Register of Program Products of the Republic of Uzbekistan № DGU 23492, 18.03.2023 - year.

A. Azizjon and U. Erkin, "Selection of a camera for recognition of raw cotton and analysis of its main parameters," 2022 International Conference on Information Science and Communications Technologies (ICISCT), Tashkent, Uzbekistan, 2022, pp. 1-4, doi: 10.1109/ICISCT55600.2022.10146835.

A. Azizjon and U. Erkin, "Selection of a camera for recognition of raw cotton and analysis of its main parameters," 2022 International Conference on Information Science and Communications Technologies (ICISCT), Tashkent, Uzbekistan, 2022, pp. 1-4, doi: 10.1109/ICISCT55600.2022.10146835.

Artemyev, A. A., Kazachkov, E. A., Matyugin, S. N., & Sharonov V. V. (2020). Classification of surface objects on visible optical range images. Bulletin of VKO Concern Almaz-Antey, (1 (32)), 8795.

Uljaev E., Abdulhamidov A. Selection of camera for cotton raw material recognition and adjustment of working slot mechanism of vertical-spindle cotton harvester by output signal from the camera, Andijan Engineering Institute "Role and importance of digital life and social sciences in education of mature generation: actual problems and prospects" International Scientific and Practical Conference. April 12, 2022 pp. 21-25.

Andrey Fedorovich Samorokovsky, & Andrey Andreevich Tolstykh (2019). Using artificial neural networks for object selection in topographic information processing. Bulletin of the Voronezh

Г,"

Institute of the Ministry of Internal Affairs of Russia, (4), 90-99.

Uzdyaev Mikhail Yurievich (2020). Recognition of aggressive actions using 3d-cnn neural network architectures. Izvestiya Tula State University. Technical Sciences, (2), 316-330.

Uljaev E., Abdulhamidov A. Analysis of work on control and regulation of the working slot of the harvesting machine and recognition of the contour of the controlled cotton field. Chemical technology control and management. International scientific and technical journal. 2022 № 2(104). Tashkent state technical university. Pp. 44-51.

Dmitry Yuryevich Klekho, Ekaterina Borisovna Karelina, & Yuri Pavlovich Batyrev (2021). Using convolutional neural network technology in image object segmentation. Forestry bulletin / Forestry bulletin, 25 (1), 140-145.

Uljaev E., Ubaydullaev U., Abdulhamidov A., Erkinov S. Analysis and selection of methods and sensors for controlling the width of the working slot of the harvesting machine HUM. Technical science and innovation, 2021, No. 3 (09), Tashkent 2021. Pages 207-216.

Uljaev E., Abdulhamidov A. Optimization of the structure of building the device of control and regulation of working slots of the harvesting apparatus of the vertical-spindle cotton harvesting machine. Samarkand branch of Tashkent University of Information Technologies named after Muhammad al-Khorazmi, collection of lectures of the republican scientific-practical conference on the theme "Modern information, communication technologies and problems of implementation in the education system", April 9, 2022, pp. 149 -151.

Akramova Gulera Abdikhalikova, Karimov Sardor Ilhom Ugli, & Abdulhamidov Azizjon Abdulla Ugli (2020). Measurement stability using peer-to-peer networks and optimization channels. Universum: Engineering Sciences, (2-1 (71)), 7-9.

I. Siddikov, O. Porubay, "Neural network model of decision making in electric power facilities under conditions of uncertainty," in E3S Web of Conferences (ICECAE 2021), EDP Sciences, Sep. 2021, Vol. 304, p. 01001, doi: 10.1051/e3sconf/202130401001

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

I. K. Siddikov, O. V. Porubay, "Neuro-fuzzy system for regulating the processes of power flows in electric power facilities," in AIP Conference

35

Muhammad al-Xorazmiy nomidagi TATU Farg'ona filiali "Al-Farg'oniy avlodlari" elektron ilmiy jurnali ISSN 2181-4252 Tom: 1 | Son: 4 | 2023-yil

"Descendants of Al-Farghani" electronic scientific journal of Fergana branch of TATU named after Muhammad al-Khorazmi. ISSN 2181-4252 Vol: 1 | Iss: 4 | 2023 year

Электронный научный журнал "Потомки Аль-Фаргани" Ферганского филиала ТАТУ имени Мухаммада аль-Хоразми ISSN 2181-4252 Том: 1 | Выпуск: 4 | 2023 год

Proceedings, AIP Publishing LLC, Jun. 2022, Vol. 2432, No. 1, p. 020010, doi: 10.1063/5.0089473

0. Porubay, I. Siddikov and K. Madina, "Algorithm for optimizing the mode of electric power systems by active power," 2022 International Conference on Information Science and Communications Technologies (ICISCT), Tashkent, Uzbekistan, 2022, pp. 1-4, doi: 10.1109/ICISCT55600.2022.10146996

1. Siddikov, O. Porubay, "An algorithm for optimizing short-term modes of electric power systems, taking into account the conditions of the nature of the probability of the information flow of data," in Journal of Physics: Conference Series, IOP Publishing, Dec. 2022, Vol. 2373, No. 8, p. 082014, doi: 10.1088/1742-6596/2373/8/082014

36

i Надоели баннеры? Вы всегда можете отключить рекламу.