KR102211078B1 - method and device for classification of parrot - Google Patents

method and device for classification of parrot Download PDF

Info

Publication number
KR102211078B1
KR102211078B1 KR1020190066883A KR20190066883A KR102211078B1 KR 102211078 B1 KR102211078 B1 KR 102211078B1 KR 1020190066883 A KR1020190066883 A KR 1020190066883A KR 20190066883 A KR20190066883 A KR 20190066883A KR 102211078 B1 KR102211078 B1 KR 102211078B1
Authority
KR
South Korea
Prior art keywords
image
parrot
model
forming
species
Prior art date
Application number
KR1020190066883A
Other languages
Korean (ko)
Other versions
KR20200140095A (en
Inventor
최대규
김동근
Original Assignee
상명대학교산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 상명대학교산학협력단 filed Critical 상명대학교산학협력단
Priority to KR1020190066883A priority Critical patent/KR102211078B1/en
Publication of KR20200140095A publication Critical patent/KR20200140095A/en
Application granted granted Critical
Publication of KR102211078B1 publication Critical patent/KR102211078B1/en

Links

Images

Classifications

    • G06K9/627
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2413Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on distances to training or reference patterns
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes

Abstract

앵무새 종을 판단하는 방법 및 장치를 개시한다. 방법:은
앵무새의 종별 이미지 데이터를 다수 수집하고, 종별 이미지 데이터를 변형하여 종별 변형 데이터를 형성하고, 이미지 데이터와 변형 데이터를 취합하여 훈련 데이터를 마련하고, 훈련 데이터에 대해 합성곱 신경망 기법으로 훈련을 행하여 앵무새 종별로 훈련된 모델 파일을 생성하고, 모델 파일을 휴대 단말 장치용 최종 모델 파일로 변환하여 휴대 단말 장치에 탑재하고, 휴대 단말 장치에 마련되는 촬영 장치를 이용하여 판별 대상 앵무새로부터 비교 이미지 데이터를 획득하고, 비교 이미지 데이터에 대해 상기 훈련된 웨이트를 이용한 합성곱 신경망 기법을 거쳐 완전연결층을 형성하고, 상기 완전연결층에 대한 다중분류 활성함수를 이용해 상기 앵무새의 확률 정보를 담은 출력층을 형성한다.
Disclosed is a method and apparatus for determining parrot species. Way
Parrots collect a lot of image data for each type of parrot, transform the image data for each type to form type transformation data, prepare training data by collecting image data and transformation data, and train the training data with a convolutional neural network technique. Generate a model file trained for each type, convert the model file into a final model file for a portable terminal device, mount it on the portable terminal device, and obtain comparative image data from the parrot to be identified using a photographing device provided in the portable terminal device. Then, a fully connected layer is formed through a convolutional neural network technique using the trained weight on the comparison image data, and an output layer containing probability information of the parrot is formed using a multi-classification activation function for the fully connected layer.

Description

영상 처리 기반 앵무새 종 분류 방법 및 장치{method and device for classification of parrot}Method and device for classification of parrot based on image processing

본 개시는 앵무새의 종을 분리하는 방법 및 장치에 관한 것으로 상세하게는 영상 처리에 의한 앵무새 종 분류 방법 및 장치에 관한 것이다.The present disclosure relates to a method and apparatus for separating species of parrots, and more particularly, to a method and apparatus for classifying parrot species by image processing.

다양한 종이 포함되는 애완동물에는 앵무새가 포함된다. 앵무새는 앵무목에 속하며, 이 앵무목에는 약 372종의 과, 왕관앵무 유황앵무가 포함되는 관앵무과, 케아앰푸 카파포 등이 포함되는 뉴질랜드 앵무과가 포함된다. 이러한 다양한 종의 앵무는 분류하기 매우 어렵고 전문가의 도움이 없이는 분류 자체가 어려운 경우가 있다. Pets that contain a variety of species include parrots. Parrots belong to the order of parrots, and this order includes the family of about 372 species, the Crown parrot family, which includes the cockatiel, and the New Zealand parrot family, which includes Keaamphu kapapo. These various species of parrots are very difficult to classify, and classification itself is sometimes difficult without expert help.

본 개시는 휴대 단말 장치를 이용해 용이하게 앵무새의 종을 판단할 수 있는 방법 및 장치를 제시한다.The present disclosure provides a method and apparatus for easily determining the species of a parrot using a portable terminal device.

본 개시는 합성곱 신경망 기법을 활용하여 실시간으로 앵무새의 종을 신속하게 판단할 수 잇는 방법 및 장치를 개시한다.The present disclosure discloses a method and apparatus for quickly determining the species of a parrot in real time using a convolutional neural network technique.

본 개시에 따른 앵무새의 종 판단 방법:은Method for determining the species of parrot according to the present disclosure:

앵무새의 종별 이미지 데이터를 다수 수집하는 단계;Collecting a plurality of image data for each type of parrot;

상기 종별 이미지 데이터를 변형하여 종별 변형 데이터를 형성하는 단계;Transforming the type image data to form type modification data;

상기 이미지 데이터와 변형 데이터를 취합하여 훈련 데이터를 마련하는 단계;Preparing training data by collecting the image data and transformation data;

상기 훈련 데이터에 대해 합성곱 신경망 기법으로 훈련을 행하여 앵무새 종별로 훈련된 웨이트를 포함하는 모델 파일을 생성하는 단계;Generating a model file including weights trained for each parrot species by performing training on the training data using a convolutional neural network technique;

상기 모델 파일을 휴대 단말 장치용 최종 모델 파일로 변환하여 상기 휴대 단말 장치에 탑재하는 단계;Converting the model file into a final model file for a portable terminal device and mounting it on the portable terminal device;

상기 휴대 단말 장치에 마련되는 촬영 장치를 이용하여 판별 대상 앵무새로부터 비교 이미지 데이터를 획득하는 단계;Obtaining comparison image data from a parrot to be determined using a photographing device provided in the portable terminal device;

상기 비교 이미지 데이터에 대해 상기 훈련된 웨이트를 이용한 합성곱 신경망 기법을 거쳐 완전연결층을 형성하는 단계;Forming a fully connected layer through a convolutional neural network technique using the trained weight on the comparison image data;

상기 완전연결층에 대한 다중분류 활성함수를 이용해 상기 앵무새의 정보를 담은 출력층을 형성하는 단계;를 포함할 수 있다.And forming an output layer containing information of the parrot using a multi-classification activation function for the fully connected layer.

하나 또는 그 이상의 실시 예에 따르면, 상기 합성곱 신경망 기법은 풀링 과정과 정류화 과정 중 적어도 어느 하나를 포함할 수 있다.According to one or more embodiments, the convolutional neural network technique may include at least one of a pooling process and a rectification process.

하나 또는 그 이상의 실시 예에 따르면, 상기 훈련 데이터에 대한 합성곱 수행 후, 정류화 과정이 수행될 수 있다.According to one or more embodiments, after convolution is performed on the training data, a rectification process may be performed.

하나 또는 그 이상의 실시 예에 따르면, 다중분류 활성함수로 소프트맥스(softmax) 알고리즘이 적용될 수 있다.According to one or more embodiments, a softmax algorithm may be applied as a multiple classification activation function.

하나 또는 그 이상의 실시 예에 따르면, 상기 종별 이미지 데이터로부터 종별 변형 데이터를 형성하는 단계는 종별 이미지의 폭 또는 높이의 변화, 확대 또는 축소, 수평 또는 수직 방향의 뒤집기(flip)를 통해 변형 데이터를 형성할 수 있다.According to one or more embodiments, the step of forming type deformation data from the type image data comprises changing the width or height of the type image, expanding or reducing it, and forming the deformation data by flipping in a horizontal or vertical direction. can do.

본 개시에 따른 앵무새의 종 판단 장치:는Parrot species determination device according to the present disclosure:

상기 방법에 의해 얻어진 최종 모델 파일을 저장하는 메모리;A memory for storing the final model file obtained by the method;

판별 대상 앵무새로부터 비교 이미지 데이터를 획득하는 카메라;A camera for obtaining comparison image data from the parrot to be determined;

상기 촬영 장치에 의해 획득한 비교 이미지 데이터에 대해 상기 훈련된 웨이트를 이용한 합성곱 신경망 기법을 거쳐 완전연결층을 형성하고, 상기 완전연결층에 대한 다중분류 활성함수를 이용해 상기 앵무새의 정보를 담은 출력층을 형성하는 프로세서;An output layer containing information of the parrot using a convolutional neural network technique using the trained weight on the comparison image data acquired by the imaging device to form a fully connected layer, and using a multi-classification activation function for the fully connected layer A processor forming a;

상기 프로세서에 의한 앵무새의 정보를 출력하는 디스플레이;를 포함할 수 있다.It may include a; display for outputting the parrot information by the processor.

하나 또는 그 이상의 실시 예에 따른 앵무새 종 판단 장치에서, 상기 프로세서는 다중분류 활성함수로 소프트맥스(softmax) 알고리즘이 적용할 수 있다.In the parrot species determination apparatus according to one or more embodiments, the processor may apply a softmax algorithm as a multi-classification activation function.

하나 또는 그 이상의 실시 예에 따르면, 프로세서는 상기 종별 이미지 데이터로부터 종별 변형 데이터를 형성함에 있어서 종별 이미지의 폭 또는 높이의 변화, 확대 또는 축소, 수평 또는 수직 방향의 뒤집기(flip)를 통해 변형 데이터를 형성할 수 있다.According to one or more embodiments, in forming the type deformation data from the type image data, the processor converts the deformation data through a change in the width or height of the type image, enlargement or reduction, or flip in a horizontal or vertical direction. Can be formed.

도1은 하나 또는 그 이상의 실시 예에 따른 앵무새 종 판단 방법의 개략적 흐름도이다.
도2는 하나 또는 그 이상의 실시 예에 따른 앵무새 종 판단 방법에서 데이터 확보 및 전처리 과정의 흐름도이다.
도3은 하나 또는 그 이상의 실시 예에 따른 앵무새 종 판단 방법에서 모델 생성 및 훈련의 흐름도이다.
도4는 하나 또는 그 이상의 실시 예에 따른 앵무새 종 판단 방법에서 앵무새의 직접적 촬영에 의해 얻어진 이미지 데이터를 예시한다.
도5는 하나 또는 그 이상의 실시 예에 따른 앵무새 종 판단 방법에서 웹 크롤링에 의해 확보한 이미지 데이터를 예시한다.
도6은 도4는 하나 또는 그 이상의 실시 예에 따른 앵무새 종 판단 방법에서 원형 이미지 데이터와 변형에 의해 얻어진 변형 이미지 데이터를 비교해 보인다.
도7 내지 도9은 도4는 하나 또는 그 이상의 실시 예에 따른 앵무새 종 판단 장치에 의한 앵무새의 확률적 판단 결과를 예시한다.
도10은 하나 또는 그 이상의 실시 예에 따른 앵무새 종 판단 장치의 개략적 구성을 예시한다.
1 is a schematic flowchart of a method for determining a parrot species according to one or more embodiments.
2 is a flowchart illustrating a process of obtaining data and preprocessing in a method for determining a parrot species according to one or more embodiments.
3 is a flowchart of model generation and training in a method for determining a parrot species according to one or more embodiments.
4 illustrates image data obtained by direct photographing of a parrot in a method for determining a parrot species according to one or more embodiments.
5 illustrates image data secured by web crawling in a method for determining parrot species according to one or more embodiments.
FIG. 6 is a view comparing circular image data and transformed image data obtained by transformation in a method for determining parrot species according to one or more embodiments.
7 to 9 illustrate a result of probabilistic determination of a parrot by an apparatus for determining a parrot species according to one or more embodiments.
10 illustrates a schematic configuration of an apparatus for determining a parrot species according to one or more embodiments.

이하, 첨부된 도면을 참고하면서 하나 또는 그 이상의 실시 예에 따른 앵무새 종 판단 방법 및 장치를 설명한다.Hereinafter, a method and apparatus for determining a parrot species according to one or more embodiments will be described with reference to the accompanying drawings.

본 발명에 따른 앵무새 종 판단 방법은 도1에 도시된 바와 같은 단계를 포함한다.The method for determining parrot species according to the present invention includes the steps as shown in FIG. 1.

제1단계는 훈련을 위한 데이터 수집 및 전처리 단계이며, 제2단계는 모델 생성 및 데이터를 이용한 훈련, 제3단계; 훈련이 완료된 모델을 휴대용 단말 장치용으로 변환 및 탑재하는 단계, 상기 앵무새 종 판단을 위한 앵무새 종 판단부(앱)을 구동하는 단계, 그리고 실시간 판단 대상 앵무새를 촬영하여 얻은 이미지 데이터를 상기 모델에 적용하여 상기 앵무새의 종을 판단하는 단계를 포함한다. The first step is a data collection and pre-processing step for training, and the second step is a model generation and training using data, a third step; Converting and loading the trained model for a portable terminal device, driving a parrot species determination unit (app) for determining the parrot species, and applying image data obtained by photographing a parrot to be determined in real time to the model It includes the step of determining the species of the parrot.

구체적으로 상기의 단계는 아래와 같이 세분화될 수 있다.Specifically, the above steps may be subdivided as follows.

<제1단계: 데이터 수집 및 전처리 단계><Step 1: Data collection and pre-processing>

1. 영상 정보 수집1. Video information collection

다양한 종별 앵무새의 이미지 파일을 딥러닝을 위한 영상 정보로서 인터넷 검색을 통해서 수집할 수 있다. 인터넷을 통해 이미지를 검색한 후 크롤링(crawling) 또는 스크래핑(scraping)을 통해 대량 입수 가능하다. 또한, 실제 한 종 또는 다수 종의 앵무새를 다양한 방향 및 자세로 촬영하여 이미지 파일(영상 정보)을 획득할 수 있다. 한편, 이미지 파일을 실제 앵무새로부터 카메라를 이용해 획득함에 있어서, 움직이는 앵무새를 일정 시간 동안 여러 자세로 촬영하여 동영상을 얻고, 이 동영상으로부터 프레임 단위로 다수의 이미지 파일을 획득할 수 도 있다. 그러나, 이 경우 하나의 종에 대해 다량의 이미지 파일을 얻게 되며, 이런 이미지 파일만을 훈련용으로 사용하게 되면 과적합이 일어날 가능성이 있다. 따라서 동영상을 획득함에 있어서는 다양한 종에 대해 고른 동영상의 확보가 필요하다. Image files of various types of parrots can be collected through internet search as video information for deep learning. After searching for images through the Internet, they can be obtained in bulk through crawling or scraping. In addition, an image file (image information) may be obtained by actually photographing one species or a plurality of species of parrots in various directions and postures. Meanwhile, in acquiring an image file from an actual parrot using a camera, a moving parrot may be photographed in various postures for a certain period of time to obtain a video, and a plurality of image files may be acquired from this video in units of frames. However, in this case, a large number of image files are obtained for one species, and if only such image files are used for training, there is a possibility of overfitting. Therefore, in obtaining a video, it is necessary to secure a video selected for various species.

2. 영상 정보 확장2. Video information expansion

위의 과정에서의 수집 및 촬영에 의해 획득한 영상 정보는 그 양에 있어서 충분한 훈련용 영상 정보로서 부족할 수 있다. 따라서 보다 효과적인 딥러닝(모델의 훈련)을 위해 영상 정보를 충분하게 확보할 필요가 있다. 이를 위하여 본 실시 예에서는 위의 과정에서 획득한 원형(raw) 이미지 파일(정보)를 변형하여 변형(modified)된 영상 정보를 생성하여 이를 훈련용 영상 정보로 사용한다.The image information acquired by collection and photographing in the above process may be insufficient as image information for training sufficient in its amount. Therefore, it is necessary to secure sufficient image information for more effective deep learning (model training). To this end, in the present embodiment, a raw image file (information) obtained in the above process is transformed to generate modified image information, and this is used as training image information.

이미지 파일의 변형에는 사이즈 변환(resizing or rescale), 예를 들어 수직 또는 수평 폭 감소 또는 확장, 수직 또는 수평 방향의 이미지 쉬프트, 이미지의 줌인(zoon-n) 또는 줌아웃(zoom-out), 이미지의 수직 또는 수평 방향의 뒤집기(flip), 이미지의 의도적 뒤틀기 또는 왜곡(twist or distortion) 등이 포함될 수 있다.Transformation of an image file includes resizing or rescale, e.g. vertical or horizontal width reduction or expansion, image shift in vertical or horizontal direction, image zoom-in (zoon-n) or zoom-out (image). This may include vertical or horizontal flip, intentional twist or distortion of the image, and the like.

3. 영상 정보 전처리3. Video information preprocessing

위의 과정에서 확보된 이미지들은 서로 다른 다양한 크기를 가질 수 있는데, 이를 일정한 크기로 사이즈를 조정한다. 예를 들어 모든 이미지 파일의 크기를 수직*수평 224*224 픽셀의 크기로 조정한다. 이러한 이미지의 특정한 크기는 사용되는 훈련 모듈에 따라 달리할 수 있다.The images secured in the above process can have various sizes different from each other, and the size is adjusted to a certain size. For example, all image files are resized to a size of 224*224 vertical*horizontal pixels. The specific size of these images can vary depending on the training module used.

<제2단계: 훈련 모델 생성 및 훈련><Step 2: Create and train a training model>

훈련을 위한 오브젝(object)로서의 모델은 다차원 구조의 CNN(Convolution Neural Network)의 구조를 가진다. CNN은 다중의 계층(레이어)를 가진다. 모델의 형성은 프로그래밍 기법에 의한 모델(객체)의 선언 및 모델에 대한 레이어의 누적에 의해 얻어진다.The model as an object for training has a multidimensional structure of CNN (Convolution Neural Network). CNN has multiple layers (layers). Model formation is obtained by declaring a model (object) by programming techniques and by accumulating layers for the model.

이러한 CNN은 특징 추출(feature extraction) 및 분류(classification)의 과정을 포함하며, 다음과 같이 알려 진 구성 요소를 포함한다.This CNN includes the process of feature extraction and classification, and includes known components as follows.

1) 입력층 (Input Layer)1) Input Layer

입력층은 원형 이미지(raw image)의 정보를 저장하는 다차원 텐서(tensor)이다.이러한 텐서는 이미지 번호를 포함해서 B/W 단채널 또는 R, G, B 3 채널 각각의 화소값(pixel value)을 저장하며, 일반적으로 4차원의 구조를 가진다.The input layer is a multidimensional tensor that stores the information of the raw image. This tensor includes the image number and the pixel value of each of the B/W single channels or the R, G, and B 3 channels. And has a four-dimensional structure in general.

2) 컨볼루션 계층 (Convolution Layer)2) Convolution Layer

입력층 또는 이전(previous) 계층으로부터의 이미지 정보에 지정된 수의 2D 또는 3D 필터를 적용하여 출력 특성맵를 형성한다. 따라서, 출력 특성맵의 수는 지정된 필터의 수와 같다. 컨볼루션 계층은 필터의 웨이트(가중치)들과 이전 계층의 이미지의 작은 패치들 사이에서 벡터의 내적(dot product)를 계산한다.An output feature map is formed by applying a specified number of 2D or 3D filters to image information from an input layer or a previous layer. Therefore, the number of output feature maps is equal to the number of specified filters. The convolutional layer computes the dot product of a vector between the weights (weights) of the filter and small patches of the image of the previous layer.

3) 활성화 함수(Activation Function)3) Activation Function

활성화 함수는 ReLU(Rectified Linear Unit)로서 신경망에 비선형성을 부여한다.The activation function is ReLU (Rectified Linear Unit), which imparts nonlinearity to the neural network.

4) 풀링 계층 (Pooling Layer)4) Pooling Layer

풀링에서는 이미지의 부분적 또는 지역적 최대 풀링 또는 평균 풀링을 통해서 이미지를 다운 샘플링한다.In pooling, an image is down-sampled through partial or regional maximum pooling or average pooling of the image.

5) 완전 연결 계층 (Fully Connected Layer)5) Fully Connected Layer

완전 연결 계층 이전에는 마지막 컨볼류션 레이에 대한 평탄화(Flatten)가 수행딘다. 평탄화 레이어(Flatten Layer)는 CNN 모델의 데이터 타입을 FCNN(Fully Connected Neural Nestwork)의 형태로 변경하는 레이어로서 그 결과가 완전 연결계층의 입력이 된다. 완전 연결 계층은 마지막 계층에서의 출력 스코어를 계산한다. 완전 연결 계층의 사이즈는 1x1xL 이며, L 은 훈련 데이터에서의 클래스의 수(number)이다.Before the fully connected layer, flattening is performed on the last convolutional ray. The flattening layer is a layer that changes the data type of the CNN model into the form of FCNN (Fully Connected Neural Nestwork), and the result becomes the input of the fully connected layer. The fully connected layer computes the output score at the last layer. The size of the fully connected layer is 1x1xL, and L is the number of classes in the training data.

6) 분류함수 계층6) Classification function layer

분류에서 2 개 이상의 클래스가 있는 경우 분류함수, 예를 들어 소프트맥스(Softmax) 함수를 이용해 출력 레이어를 형성한다. 소프트맥스 함수는 클래스에 대한 이산확률분포를 예측하는 방법을 제공한다.When there are two or more classes in the classification, an output layer is formed using a classification function, for example, a Softmax function. The softmax function provides a method of predicting the discrete probability distribution for a class.

CNN 모델의 훈련은 상기와 같은 구조의 모델에 대해 프로그래밍 기법에 의해 수행되며, 이 과정에서 역전파(Backpropagation)에 의한 출력층의 가중치() 갱신(update)가 수행된다. 잘 알려진 바와 같이 역전파 알고리즘은 오차에 비례하여 출력층(Output layer)의 가중치(weight)를 갱신하고, 그 다음 은닉층(Hidden layer)의 가중치를 갱신한다. 위와 같은 모델에 대한 훈련이 완료되면, 목적하는 파일 형태의 훈련된 CNN 모델을 얻게 된다.Training of the CNN model is performed by programming techniques for the model of the structure as described above, and in this process, the weight () update of the output layer is performed by backpropagation. As is well known, the backpropagation algorithm updates the weight of the output layer in proportion to the error, and then updates the weight of the hidden layer. When training for the above model is completed, a trained CNN model in the form of a target file is obtained.

상기 CNN 모델은 본 발명에 따라 모바일 기기에서 앵무새의 종 판단에 사용된다. 이를 위해 CNN 모델은 모바일 기기에서 사용할 수 있는 모델 형태로 변환된다. 모델의 변환의 파일의 변환(conversion)에 의해 이루어지며 본 실시 예에서는 오픈 소스인 텐스플로라이트용 파일로 변환한다. 모바일 기기는 텐스플로라이트의 오픈소스를 앵무새 종 판단을 위해 상기 모델 파일을 사용하도록 해당 부분을 수정(약10줄 이내)하고 최종 APK 파일을 빌드한다. 이러한 APK 파일은 모바일 기기에 탑재되며, 이 APK는 훈련된 모델을 탑재이용해 피판단대상이 앵무새를 촬영하면서 종을 판단한다.The CNN model is used to determine the species of parrot in a mobile device according to the present invention. For this, the CNN model is converted into a model that can be used in mobile devices. The conversion of the model is performed by conversion of a file, and in this embodiment, it is converted into an open source file for Tensflolite. The mobile device modifies the relevant part (within about 10 lines) to use the model file for determining the parrot species, and builds the final APK file. This APK file is mounted on a mobile device, and this APK is loaded with a trained model to determine the species while the subject to be judged photographs the parrot.

이하에서 실험에서 사용된 이미지 데이터 수집 및 확대 그리고 이를 이용한모델의 생성에 대한 구체적인 프로그래밍 기법에 대해 설명한다.Hereinafter, a detailed programming technique for collecting and expanding image data used in the experiment and generating a model using the same will be described.

본 실험에서는 3종의 앵무새에 대한 분류를 실시하였다.앵무새 각 종 별로 총 2,535장의 이미지를 확보하였고, 훈련셋(Training Set)으로 1,735장(약 70%), 테스트 셋과 검증 셋(Test Set and Validation Set)으로 각 400장(약 15%)로 나누었다In this experiment, 3 types of parrots were classified. A total of 2,535 images were obtained for each species of parrot, and 1,735 images (approximately 70%) as a training set, and a test set and a test set were obtained. Validation Set), divided into 400 sheets (about 15%)

훈련을 위한 이미지 데이터는 크게 두 가지 방법으로 확보하였다. 첫 번째는 서울 대공원에서 촬영한 이미지(도4 참고)이며, 둘째는 키워드 검색에 의한 인터넷 크롤링을 이용하여 얻은 이미지(도5 참고)이다. 서울 대공원에서 보유하고 있는 앵무새 종 20종에 대하여 각 500여장의 이미지를 확보했다. 각 이미지는 불필요한 배경 부분을 제거하고 640 x 480 픽셀 크기로 이미지 크기를 조정하였다.Image data for training were largely obtained in two ways. The first is an image taken at Seoul Grand Park (see Fig. 4), and the second is an image obtained using Internet crawling by keyword search (see Fig. 5). About 500 images of each of the 20 parrot species possessed in Seoul Grand Park were secured. For each image, unnecessary background parts were removed and the image size was resized to a size of 640 x 480 pixels.

도4는 서울대 공원에서 확보한 동영상으로부터 프레임 단위로 분리하여 낸 원형 이미지를 예시이며, 도5는 인터넷 크롤링에 의해 얻은 이미지 데이터를 예시한다.FIG. 4 is an example of a circular image obtained by separating in a frame unit from a video secured at Seoul National University Park, and FIG. 5 illustrates image data obtained by Internet crawling.

도4에 도시된 이미지 데이터는 동영상의 프레임 단위로 다수의 이미지 파일들이 확보했기 때문에 이들 이미지들이 상당히 유사하다. 그래서 이런 유사 데이터만을 사용했을 경우 과적합이 일어날 가능성이 크다. 이를 방지하기 위해서 동일한 앵무새 종의 다른 이미지들이 필요하다. In the image data shown in Fig. 4, since a plurality of image files are secured in units of frames of a moving picture, these images are quite similar. So, if only such similar data is used, overfitting is likely to occur. To avoid this, different images of the same parrot species are needed.

한편, 도5에 도시된 바와 같은 크롤링에 의한 이미지 데이터의 확보를 위한,모듈로서는 웹으로부터 데이터를 가져올 때 보편적으로 사용하는 “urllib”이 사용될 수 있다. 검색 화면의 URL이 Get 방식으로 이루어진 있는 검색 구조에서 앵무새의 각 종을 질의 할 수 있는 URL을 구성하고 헤더 정보와 함께 해당 페이지에 대한 정보를 요청함으로써 바이너리 형태의 이미지 파일을 훈련을 위한 이미지 데이터로서 다운로드 할 수 있게 된다.Meanwhile, as a module for securing image data by crawling as shown in FIG. 5, "urllib", which is commonly used when data is fetched from the web, may be used. In the search structure where the URL of the search screen is made of the Get method, a URL that can query each species of parrot is constructed, and the binary image file is used as image data for training by requesting information about the page along with header information. You will be able to download it.

앞에서 언급한 방법으로 이미지 데이터를 확보 했지만 모델을 충분히 훈련시키기 위해서는 더 많은 데이터가 필요하다. 따라서 기존의 있던 데이터에 약간의 변형을 가하여 새로운 데이터를 만드는 방법으로 이미지 데이터를 더 확보(확장)할 수 있다. 이를 위해 본 발명은 아래와 같은 이미지 데이터의 변형에 의한 이미지 데이터 확장을 실시하였다. Image data was obtained by the method mentioned above, but more data is needed to sufficiently train the model. Therefore, image data can be further secured (expanded) by creating new data by slightly modifying existing data. To this end, the present invention expanded image data by transforming image data as follows.

1. 크기 변경(resale)1. Resale

입력으로 들어온 원형 이미지 데이터에 지정한 값을 곱하여 크기를 변경한다.The size is changed by multiplying the circular image data received as input by the specified value.

2. 폭 방향 좌우 밀기(Width-directional Shift)2. Wide-directional Shift

원형 이미지 데이터를 지정된 범위의 값만큼 가로로 이동 시킨다.The circular image data is moved horizontally by the value of the specified range.

3. 높이 방향 상하 이동(Hight-directional Shift)3. Height-directional shift

원형 이미지 데이터를 지정된 범위값 내에서 세로로 이동시킨다.The circular image data is moved vertically within the specified range.

4. 줌인 또는 줌아웃4. Zoom in or zoom out

원형 이미지를 지정한 범위 내의 임의의 값만큼 줌 인 또는 줌 아웃 시킨다.The circular image is zoomed in or out by an arbitrary value within the specified range.

5. 뒤집기(flip)5. Flip

원형 이미지를 수직 또는 수평 방향으로 반전시킨다.Invert the original image vertically or horizontally.

도6는 도4의 프레임 단위의 원형 이미지에 대한 변형 과정이 복합적으로 이루어진 변형 이미지를 원형 이미지와 함께 예시한다. 도6를 참조하면, 원형 이미지에 대해 좌우 플립(flip) 및 줌인(zoom-in) 및 쉬프트(shift)가 이루어졌고 따라서 원형 이미지와는 다른 형태의 변형 이미지를 얻었다. 이러한 데이터 변형은 도5에 도시된 바와 같이 크롤링에 의해 얻은 이미지 데이터에 대해서도 수행될 수 있다. 그리고, 위와 같은 이미지 데이터의 확장은 개별적으로 얻은 스틸 이미지들에 대해서도 수행될 수 있고, 이를 통해 모델 훈련에 필요한 이미지 데이터를 충분히 확보할 수 있게 된다.FIG. 6 illustrates a modified image in which a process of transforming the circular image in a frame unit of FIG. 4 is combined with the circular image. Referring to FIG. 6, left and right flip, zoom-in, and shift were performed on the circular image, and thus, a modified image of a shape different from that of the circular image was obtained. Such data transformation can also be performed on image data obtained by crawling as shown in FIG. 5. In addition, the expansion of the image data as described above can be performed for still images individually obtained, and through this, image data necessary for model training can be sufficiently secured.

한편, 상기 이미지 데이터를 이용한 모델의 훈련에 있어서, 앵무새 종 예측을 위한 모델의 생성을 위한 컴퓨터 언어로는 Python3(파이선3)을 선택했고, 예측 모델 생성에는 Keras(케라스)를 선택했다. Python3을 선택한 이유는 데이터 과학과 머신러닝을 위한 풍부한 라이브러리들이 구현되어 있고, 실제로 많은 전문가들이 Python3을 활용하고 있으므로 커뮤니티가 크게 활성화 되어 있다는 장점 때문이다. 그 외의 예측 모델을 개발에는 tensorflow를 활용할 수 있는데, 본 발명의 실험에서는 tensorflow에 비해 더 직관적이고 쉽게 개발 할 수 있는 Keras를 적용하였다.Meanwhile, in the training of the model using the image data, Python3 (Python 3) was selected as the computer language for generating a model for predicting parrot species, and Keras (Keras) was selected for the prediction model generation. The reason for choosing Python3 is that there are rich libraries for data science and machine learning implemented, and since many experts actually use Python3, the community is greatly active. Tensorflow can be used to develop other predictive models. In the experiment of the present invention, Keras, which can be more intuitive and easily developed than tensorflow, was applied.

위와 같은 방법에 의해 확보한 이미지 데이터를 통해 훈련된 모델을 앱에 탑재하기 위해서 모듈, 예를 들어 tensorflow lite라는 모듈을 사용할 수 있다. 그런데 특정 모듈, 예를 들어 tensorflow lite를 통해 모델을 앱에 탑재하려면 이미지의 크기가 224 x 224 픽셀로 정해져 있으므로 각 이미지의 크기를 변경시킬 필요가 있다. 아래의 소스는 입력된 원형 이미지의 파일 크기를 224 x 224 크기로 변환하는 흐름을 보인다.A module, for example, a module called tensorflow lite, can be used to load the model trained with the image data obtained by the above method into the app. However, in order to mount a model in an app through a specific module, for example, tensorflow lite, the size of each image needs to be changed because the size of the image is set to 224 x 224 pixels. The source below shows the flow of converting the file size of the input circular image to the size of 224 x 224.

<소스 코드1><source code 1>

Figure 112019058019300-pat00001
Figure 112019058019300-pat00001

한편, 상기와 같이 리사이징 된 이미지를 이용한 훈련을 위하여 모델의 생성이 필요한다. 이 모델이 생성 및 훈련은 전술한 바와 같이 Keras를 이용할 수 있다. keras_train_and_test.py의 Train이라는 클래스에는 모델을 생성하고 훈련하는 기능들이 정의되어 있다. Meanwhile, it is necessary to create a model for training using the image resized as described above. This model can be created and trained using Keras as described above. In a class called Train of keras_train_and_test.py, functions for creating and training models are defined.

구체적으로 Keras 모듈의keras.preprocessing.image.ImageDataGenerator 메소드에 rescale=1./255라는 키워드 인자 값을 설정해 준다. (RGB의 256에 관련된 값들을의 정규화). 그 다음에 flow_from_directory 메소드에 필요 파라미터(인자)를 전달하여 generator 객체를 생성한다. 이 메소드의 파라미터에는 train, validation 폴더의 상대경로 값, 타겟 사이즈(target size), 클래스의 모드(class_mode), 배치 사이즈(batch size)등이 있다. 위의 파라미터에서 클래스 모드는 이진 분류할 것인지 아니면 다중 분류할 것인지를 정하는 것으로 본 발명에서는 다중 분류이므로 "categorical"로 정하였다. 한편, 배치 사이즈는 한번에 트레이닝에 가져 오는 이미지 수를 나타낸다. 예를 들어, batch_size=10 는 한번 훈련에 이미지를 10장씩 가져온다는 것을 나타낸다. 그리고, Train 클래스 객체의 set_model 메소드 안에서 모델을 생성하게 된다. Specifically, set the keyword argument value of rescale=1./255 in the keras.preprocessing.image.ImageDataGenerator method of the Keras module. (Normalization of values related to 256 of RGB). Then, create a generator object by passing the necessary parameter (argument) to the flow_from_directory method. The parameters of this method include train, relative path value of validation folder, target size, class mode (class_mode), batch size, etc. In the above parameter, the class mode determines whether to perform binary classification or multi-classification. In the present invention, since it is a multi-classification, it is set as "categorical". On the other hand, the batch size represents the number of images brought to training at one time. For example, batch_size=10 indicates that 10 images are fetched per training. And, the model is created in the set_model method of the Train class object.

아래에서 keras.Sequential을 이용해 model을 생성하는 방법에 대해 설명한다.The following describes how to create a model using keras.Sequential.

아래의 코드2는 여러 레이어 인스탄스(instanc) 리스트를 컨스트럭터(constructor) 전달함으로써 상기 레이어들이 스택(추가)된 Sequential 모델을 생성하는 방법을 예시한다.Code 2 below exemplifies a method of generating a Sequential model in which the layers are stacked (added) by passing a list of multiple layer instances to a constructor.

<소스 코드2><source code 2>

Figure 112019058019300-pat00002
Figure 112019058019300-pat00002

아래의 소스 코드3은 모델 생성 이후, add 메소드에 의해 스택(stack)에 레이어의 쌓는 방법을 예시한다.Source code 3 below exemplifies how to stack layers on the stack by the add method after model creation.

<소스 코드3><source code 3>

Figure 112019058019300-pat00003
Figure 112019058019300-pat00003

Keras의 모델 객체에서, 메소드 ADD에 파라미터가 model.add(keras.layers.Conv2D(16, kernel_size=(3, 3), activation="relu", input_shape=(224, 224, 3)))로 전달되면, 이는 컨볼루션 2차원 레이어를 추가해 주며, 이때에 사이즈가 3X3인 필터(커널)이 16개이며, 그리고 활성화 함수로는 relu를 사용되고, 그리고 224 x 224 크기의 이미지가 사용되고 이 이미지의 채널은 3(R, G, B)로 지정한다는 것이다. 같은 방법으로 MaxPool2D, Dropout, Flatten 레이더 등을 스택할 수 있다.In Keras' model object, parameter is passed to method ADD as model.add(keras.layers.Conv2D(16, kernel_size=(3, 3), activation="relu", input_shape=(224, 224, 3))) If so, it adds a convolutional 2D layer, at this time, there are 16 filters (kernels) of size 3X3, and relu is used as the activation function, and an image of size 224 x 224 is used, and the channel of this image is It is designated as 3(R, G, B). You can stack MaxPool2D, Dropout, and Flatten radars in the same way.

위와 같은 방법에 의해 훈련 모델을 생성한 후, 훈련용 이미지 데이터를 이용한 모델의 훈련을 진행한다. 이러한 훈련은, 예를 들어 "model.compile" 메소드 및 " self.model.fit_generator" 메소드를 포함하는 "start_train" 메소드에서 시작될 수 있다.After the training model is generated by the above method, training of the model is performed using the training image data. This training can be started in the "start_train" method, which includes, for example, the "model.compile" method and the "self.model.fit_generator" method.

모델의 compile 메소드(self.model.compile)의 파라미터 loss, optimizer, metrics를 아래와 같이 정의할 수 있다. The parameter loss, optimizer, and metrics of the model's compile method (self.model.compile) can be defined as follows.

<소스 코드4><Source code 4>

Figure 112019058019300-pat00004
Figure 112019058019300-pat00004

1. loss = ’categorical_crossentropy’1.loss = ’categorical_crossentropy’

이는 손실 값(=cost)을 다중 클래스에 관한 "crossentropy"로 측정하겠다는 의미이다.This means that the loss value (=cost) is measured as "crossentropy" for multiple classes.

2. optimizer=’adam’2. optimizer=’adam’

이는 손실 값을 줄이고 local maximum에 다다르도록 가중치(weights) 값들을 조정할 때, adam이라는 기법을 사용한다는 의미이다.This means that a technique called adam is used to reduce the loss value and adjust the weights values to reach the local maximum.

3. metrics=[‘accuracy’]3. metrics=[‘accuracy’]

이는 정확도를 기준으로 평가를 하겠다는 것이다. 좋은 모델인지 아닌지 평가하는 기준에는 accuracy, precision, recall, f1-score 등이 있다.This means that we will evaluate based on accuracy. The criteria for evaluating whether or not it is a good model include accuracy, precision, recall, and f1-score.

<소스코드5><Source Code 5>

Figure 112019058019300-pat00005
Figure 112019058019300-pat00005

소스 코드4의 compile 메소드 호출에 이어 메소드 "self.model.fit_generator"를 호출하면 본격적으로 훈련이 시작된다. self.train_generator는 이미지와 관련된 generator 객체이다. 위 메소드의 파라미터를 살펴보면, 1 에포크(epoch)당 24번(steps_per_epoch=24)을 훈련 하며, 총 20 에포크(epochs=20)를 수행한다. 1 epoch은 전체 train 데이터를 모두 사용해서 모델의 가중치를 조정했음을 의미이다. Training starts in earnest by calling the method "self.model.fit_generator" after calling the compile method of source code 4. self.train_generator is an image-related generator object. Looking at the parameters of the method above, it trains 24 times (steps_per_epoch=24) per 1 epoch, and performs a total of 20 epochs (epochs=20). 1 epoch means that the weight of the model is adjusted using all of the train data.

validation_data=self.validation_generator는 모델이 훈련(training) 데이터 세트에 과적합(앵무새의 특징을 잡아내는 것이 아니고 훈련 데이터의 특징에 집착하는 경향)되는 것을 방지하기 위해서 사용된다. 파라미텨 validation_steps=27은 상기 validation 데이터를 활용하여 과적합을 방지하는 과정을 27번 하겠다는 의미이다.validation_data=self.validation_generator is used to prevent the model from overfitting to the training data set (a tendency to stick to the features of the training data rather than catching features of the parrot). Parameter validation_steps=27 means that 27 times the process of preventing overfitting by using the validation data.

Test 클래스를 통해 생성해둔 모델이 실제로 잘 동작하는지 평가할 수 있다.You can evaluate whether the model created through the Test class actually works well.

Train 클래스를 생성할 때와 마찬가지로 keras.preprocessing.image.ImageDataGenerator 를 이용해 Test 클래스를 생성한다.Like when creating Train class, create Test class using keras.preprocessing.image.ImageDataGenerator.

<소스코드6><Source Code 6>

keras.preprocessing.image.ImageDataGenerator(rescale=1./255), flow_from_directory(".\\pic\\test", target_size=(224, 224), class_mode="categorical", batch_size=5)keras.preprocessing.image.ImageDataGenerator(rescale=1./255), flow_from_directory(".\\pic\\test", target_size=(224, 224), class_mode="categorical", batch_size=5)

상기 Test 클래스는 test 이미지 데이터에 관한 generator 객체이다. 평가 과정은 아래와 같은 메소드에 의해 실행될 수 있다.The Test class is a generator object related to test image data. The evaluation process can be executed by the following method.

<소스 코드7><Source Code 7>

model.evaluate_generator(self.test_generator, steps=27)
model.evaluate_generator(self.test_generator, steps=27)

위의 소스 코드7에서 steps=27은 평가 과정을 27번 시행하겠다는 뜻이다.In the above source code 7, steps=27 means that the evaluation process will be performed 27 times.

한편, 그 평가결과는 아래와 같은 print 함수에 의해 출력할 수 있다.Meanwhile, the evaluation result can be printed by the following print function.

<소스 코드8><Source Code 8>

print("%s: %.2f%%"%(self.model.metrics_names[1], score[1]*100))
print("%s: %.2f%%"%(self.model.metrics_names[1], score[1]*100))

위의 프린트 함수를 통해서 accuracy가 몇 %인지 출력한다. print_classfication_report에서는 confusion_matrix와 관련된 평가 항목을 출력한다. Print out what% accuracy is through the print function above. In print_classfication_report, evaluation items related to confusion_matrix are output.

훈련이 완료된 모델은 파일 형태로 저장된다. 예를 들어 Keras 의 경우 다음과 같이 저장 가능하다.The model after training is saved as a file. For example, Keras can be saved as follows.

<소스 코드9><Source Code 9>

file_name = "trained_model.h5"file_name = "trained_model.h5"

keras.models.save_model(self.model, file_name)
keras.models.save_model(self.model, file_name)

위의 소스 코드는 훈련된 모델을 파일이름 "trained_model.h5"로 현재 작업 디렉터리에 저장한다.The above source code saves the trained model in the current working directory under the file name "trained_model.h5".

상기와 같이 특정 모듈, 예를 들어 Keras에 의해 훈련된 모델의 파일을 모바일 기기에서 사용 가능한, 예를 들어 텐스플로우 라이트에서 이식하여 사용할 수 있도록 변화하는 것이 필요하다.As described above, it is necessary to change the file of a specific module, for example, a model trained by Keras, to be usable in a mobile device, for example, to be ported and used in TensFlow Lite.

convert_from_keras_to_tflite.py의 Converter 클래스에는 저장한 h5파일을 .텐스플로우 라이트용 tflite 파일로 바꿔주는 기능을 가지고 있다.The Converter class of convert_from_keras_to_tflite.py has a function to convert the saved h5 file into a tflite file for .Tensflow Lite.

<소스 코드10><Source Code 10>

converter = converter =

lite.TFLiteConverter.from_keras_model_file("trained_model.h5") lite.TFLiteConverter.from_keras_model_file("trained_model.h5")

tfilite_mode = conveter.comver()
tfilite_mode = conveter.comver()

위의 소스 코드10은 위에서 생성된 "trained_model.h5"을 " trained_model..tflite"로 변환하는 "converter" 객체를 생성하고, converter.convert() 여기서는 실제로 변환하여 tfilite_mode로 저장한다.The above source code 10 creates a "converter" object that converts "trained_model.h5" created above to "trained_model..tflite", and in converter.convert() it actually converts and saves it as tfilite_mode.

<소스코드 11><Source Code 11>

open("trained_model.tflite", "wb").write(tflite_model)
open("trained_model.tflite", "wb").write(tflite_model)

위의 open 함수는 trained_model.tflite라는 파일을 binary write모드 형태로 열고 여기에 tflte_model 데이터로 저장한다. 이렇게 하면 최종적으로 trained_model.tflite 라는 파일이 생성된다. 이 파일은 이를 사용하는 앵무새 종별 판단 장치, 예를 들어 휴대용 단말 장치에 앵무새 종 판단 앱과 함께 저장한다. 예를 들어, 텐스플로 라이트에 사용하기 위하여 상기 trained_model.tflite 파일을 해당 앱의 안드로이드 스튜디오 프로젝트의 assets 폴더 안에 집어넣고, 앵무새 종별 판단 장치로 사용될 휴대용 디바이스를 연결하여 상기 프로젝트를 빌드하면 상기 앵무새 종 판단 앱이 디바이스에 설치된다. The open function above opens a file called trained_model.tflite in binary write mode and saves it as tflte_model data. This will finally create a file called trained_model.tflite. This file is stored together with the parrot species determination app in a parrot type determination device using this, for example, a portable terminal device. For example, if the trained_model.tflite file is inserted into the assets folder of the Android Studio project of the app to be used in TensFlow Lite, and the project is built by connecting a portable device to be used as a parrot type determination device, the parrot species is determined. The app is installed on the device.

<소스코드12><Source Code 12>

Figure 112019058019300-pat00006
Figure 112019058019300-pat00006

<소스 코드13><Source Code 13>

Figure 112019058019300-pat00007
Figure 112019058019300-pat00007

위의 소스 코드 12, 13은 수정된 텐스플로라이트 프로젝트의 코드 수정 부분을 보인다. 여기에서, 앞에서 생성한 tflite 파일과 라벨(label)이 적혀 있는 텍스트 파일(labels_test.txt)을 asset 폴더에 집어넣고 test. tflite 파일의 분류기를 위한 클래스를 생성한다. 그리고 나서 카메라 액티비티와 프래그먼트를 연결시켜주는 코드 부분을 변경해준다. Source codes 12 and 13 above show the code modification part of the modified Tensflolite project. Here, put the tflite file created earlier and the text file (labels_test.txt) with the label written on it into the asset folder and test. Create a class for classifiers for tflite files. Then we change the part of the code that connects the camera activity and the fragment.

도7 내지 도9는 상기 앱을 빌드 후의 휴대용 단말 장치로 판단대상 앵무새를 카메라로 인식시킨 결과를 보인다. 도7은 앵무새의 종이 약 94%의 확률로 ara chloroptera (홍금강앵무)로 판정하고 있으며, 도8은 Cacatua goffiniana (흰이마유황앵무) 가 0.92로서 약 92%의 확률로 판정되고 있으며, 도9는 Eclectus roratus (뉴기니앵무)로서 1.0 의 확률, 즉 100%의 확률로 앵무새 종을 판단하고 있고, 실제 종판단 결과 100% 정확히 종의 판단하였음을 확인하였다.7 to 9 show a result of recognizing a parrot to be determined by a camera by a portable terminal device after the app is built. Figure 7 is a species of parrot is judged as ara chloroptera with a probability of 94%, Figure 8 is Cacatua goffiniana (white-fronted sulfur parrot) is judged with a probability of about 92% as 0.92, Figure 9 Is Eclectus roratus (New Guinea parrot), which judges parrot species with a probability of 1.0, that is, 100%, and as a result of the actual final determination, it was confirmed that the species was judged 100% accurately.

휴대단말 장치는 내장 카메라를 이용해 판단 대상 앵무새를 실시간 촬영하고, 촬영된 이미지 정보를 상기 훈련된 모델에 적용하여 해당 앵무새의 종이 확률적으로 판단된다. 휴대단말 장치의 카메라를 통해 획득한 앵무새 이미지의 프레임의 R, G, B 3 채널의 픽셀 정보(화소값)는 합성곱신경망(CNN) 과정을 통해 처리되어 최종의 소프트맥스 알고리즘을 통해 특정 종에 대한 확률을 나타내는 벡터가 얻어진다. 이를 위해 이미지의 픽셀 정보는 미리 훈련이 완료된 모델의 고정된 웨이트 값과 곱해지고 이 값들이 더하면 최종적으로 행렬 형태의 출력값이 나온다. 이 출력값은 평탄화(flattern) 된 후 완전 연결 계층을 형성하고, 이것으로부터 다중분류 활성함수, 예를 들어 softmax 알고리즘을 통해 원하는 레이블(분류)의 수 만큼(본 실시 예에서는 앵무새 3종이기 때문에 요소 3개) 요소를 가지는 벡터가 나온다. 이 벡터의 값 중에서 최대값이 특정 종의 판단 기준이 되는 최종 예측 값이 되며, 휴대용 단말 장치에는 이 벡터값과 해당 종의 레이블이 출력된다. 예를 들어 백터 값이 [0.3, 0.6, 0.1]이 나오면 예측값은 2번 앵무새(label 2)로 나온다. 이는 2번 앵무새 일 확률이 0.6으로 3가지 중에 제일 높기 때문이다.The portable terminal device uses a built-in camera to capture a parrot to be determined in real time, and applies the captured image information to the trained model to determine the species of the parrot probabilistically. Pixel information (pixel values) of 3 channels R, G, and B of the frame of the parrot image acquired through the camera of the mobile terminal device is processed through a convolutional neural network (CNN) process, and is then processed through the final Softmax algorithm to a specific species. A vector representing the probability for is obtained. To this end, the pixel information of the image is multiplied by a fixed weight value of a model that has been trained in advance, and when these values are added, an output value in the form of a matrix is finally obtained. This output value is flattened to form a fully connected layer, from which the number of labels (classification) desired through a multi-classification activation function, e.g., softmax algorithm (in this example, 3 parrots, so factor 3 A vector with elements). Among the values of this vector, the maximum value becomes the final predicted value that is the criterion for determining a specific species, and the vector value and the label of the corresponding species are output to the portable terminal device. For example, if the vector value is [0.3, 0.6, 0.1], the predicted value is parrot number 2 (label 2). This is because the probability of being parrot 2 is 0.6, which is the highest among the three.

위의 실시 예의 설명에서는 3종의 앵무새에 대해서만 분류가 시도되었는데, 보다 다양한 종에 대한 훈련을 통해서 분류 종의 수를 확대할 수 있을 것이다.In the description of the above embodiment, classification was attempted only on three types of parrots, but the number of classified species may be expanded through training on more diverse species.

본 발명은 훈련 데이터의 부족은 변형 데이터를 확대하고, 그리고 이를 통해서 보다 다양한 형태로 훈련된 모델을 구성할 수 있다. 이러한 본 발명은 앵무새 종을 판단함에 있어서 휴대용 단말 장치를 통해 실시간 판정이 가능하게 되며, 이는 신속 정확한 처리가 가능하다. 이러한 본 발명은 매장에서뿐 아니라 통관 과정에서도 적용 요구되는 밀수입된 애완동물, 그 중에서도 앵무새에 관하여 각 개체의 종에 대한 정보를 획득하기 용이하게 된다.In the present invention, the lack of training data expands the transformed data, and through this, it is possible to construct a trained model in more various forms. In the present invention, in determining the parrot species, real-time determination is possible through a portable terminal device, which enables rapid and accurate processing. The present invention makes it easy to obtain information on the species of each individual about smuggled pets, especially parrots, which are required to be applied not only in stores but also in customs clearance.

도10에 도시된 바와 같이, 본 개시에 따른 앵무새의 종 판단 장치:는 상기 방법에 의해 얻어진 최종 모델 파일(훈련된 모델)을 저장하는 메모리; 판별 대상 앵무새로부터 비교 이미지 데이터를 획득하는 카메라; 종판단 앱(APK)를 로딩하여, 상기 촬영 장치에 의해 획득한 비교 이미지 데이터에 대해 상기 훈련된 웨이트를 이용한 합성곱 신경망 기법을 거쳐 완전연결층을 형성하고, 상기 완전연결층에 대한 다중분류 활성함수를 이용해 상기 앵무새의 정보를 담은 출력층(출력벡터)을 형성하는 프로세서; 상기 프로세서에 의한 앵무새의 정보를 출력하는 디스플레이;를 포함할 수 있다.As shown in Fig. 10, the parrot species determination apparatus according to the present disclosure includes: a memory storing a final model file (trained model) obtained by the method; A camera for obtaining comparison image data from the parrot to be determined; By loading an end determination app (APK), a fully connected layer is formed through a convolutional neural network technique using the trained weight on the comparative image data acquired by the imaging device, and multi-classification is activated for the fully connected layer. A processor that forms an output layer (output vector) containing the parrot information using a function; It may include a; display for outputting the parrot information by the processor.

상기 프로세서는 CPU 또는 GPU 이며, 본 발명은 특정 프로세서에 의해 기술적으로 제한되지 않는다.The processor is a CPU or GPU, and the present invention is not technically limited by a specific processor.

상기 앵무새 종 판단 장치에서, 상기 프로세서는 다중분류 활성함수로 소프트맥스(softmax) 알고리즘이 적용할 수 있다.In the parrot species determination apparatus, the processor may apply a softmax algorithm as a multi-classification activation function.

또한, CPU 또는 GPU 등으로 된 상기 프로세서는 상기 종별 이미지 데이터로부터 종별 변형 데이터를 형성함에 있어서 종별 이미지의 폭 또는 높이의 변화, 확대 또는 축소, 수평 또는 수직 방향의 뒤집기(flip)를 통해 변형 데이터를 형성할 수 있다.In addition, the processor, such as a CPU or GPU, may change the width or height of the type image, enlarge or reduce it, or flip the deformation data in the horizontal or vertical direction in forming type deformation data from the type image data. Can be formed.

이상에서 살펴본 바와 같이 본 발명의 모범적 실시 예들에 대해 상세히 기술되었지만, 본 발명이 속하는 기술분야에 있어서 통상의 지식을 가진 사람이라면, 첨부된 청구 범위에 정의된 본 발명의 정신 및 범위를 벗어나지 않으면서 본 발명을 여러 가지로 변형하여 실시할 수 있을 것이다. 따라서 본 발명의 앞으로의 실시 예들의 변경은 본 발명의 기술을 벗어날 수 없을 것이다.As described above, exemplary embodiments of the present invention have been described in detail, but those of ordinary skill in the art to which the present invention pertains, without departing from the spirit and scope of the present invention defined in the appended claims. It will be possible to practice the present invention by various modifications. Therefore, changes to the embodiments of the present invention will not be able to depart from the technology of the present invention.

Claims (10)

앵무새의 종별 원형 이미지(raw image)를 다수 수집하는 단계;
수집된 상기 종별 원형 이미지를 다른 형태로 변형하여 종별 변형 이미지(modified image)를 형성하는 단계;
상기 원형 이미지와 변형 이미지를 취합하여 훈련 데이터를 마련하는 단계;
다차원 구조의 합성곱 신경망 구조를 가지는 모델을 생성하고, 상기 원형 이미지 데이터와 변형 이미지가 취합된 상기 훈련 데이터를 이용해 상기 모델을 훈련시켜 앵무새 종별로 훈련된 웨이트를 포함하는 모델 파일을 생성하는 단계;
상기 모델 파일을 휴대 단말 장치용 최종 모델 파일로 변환하여 상기 휴대 단말 장치에 탑재하는 단계;
상기 휴대 단말 장치에 마련되는 촬영 장치를 이용하여 판별 대상 앵무새로부터 비교 이미지를 획득하는 단계;
상기 비교 이미지에 대해 상기 훈련된 웨이트를 이용한 합성곱 신경망 기법을 거쳐 완전연결층을 형성하는 단계; 그리고
상기 완전연결층에 대한 다중분류 활성함수를 이용해 상기 앵무새의 확률 정보를 담은 출력층을 형성하는 단계;를 포함하는 앵무새 종 판단 방법.
Collecting a plurality of raw images for each type of parrot;
Forming a modified image for each type by transforming the collected circular image for each type into another shape;
Preparing training data by collecting the original image and the transformed image;
Generating a model having a multidimensional convolutional neural network structure, training the model using the training data in which the circular image data and the transformed image are collected, and generating a model file including weights trained for each parrot species;
Converting the model file into a final model file for a portable terminal device and mounting it on the portable terminal device;
Obtaining a comparison image from a parrot to be determined using a photographing device provided in the portable terminal device;
Forming a fully connected layer through a convolutional neural network technique using the trained weight on the comparison image; And
Forming an output layer containing probability information of the parrot using a multi-classification activation function for the fully connected layer; Parrot species determination method comprising a.
제1항에 있어서,
다중분류 활성함수로 소프트맥스(softmax) 알고리즘이 적용되는 앵무새 종 판단 방법.
The method of claim 1,
A parrot species determination method to which a softmax algorithm is applied as a multiple classification activation function.
제1항 또는 제2항에 있어서,
상기 원형 이미지로부터 변형 이미지를 형성하는 단계는 원형 이미지의 폭 또는 높이의 변화를 통해 변형 이미지를 형성하는, 앵무새 종 판단방법.
The method according to claim 1 or 2,
The step of forming a deformed image from the circular image comprises forming a deformed image through a change in the width or height of the circular image, parrot species determination method.
제1항 또는 제2항에 있어서,
상기 원형 이미지로부터 변형 이미지를 형성하는 단계는 원형 이미지의 확대 또는 축소를 통해 변형 이미지를 형성하는, 앵무새 종 판단방법.
The method according to claim 1 or 2,
The step of forming a deformed image from the circular image includes forming a deformed image through enlargement or reduction of the circular image.
제1항 또는 제2항에 있어서,
상기 원형 이미지로부터 변형 이미지를 형성하는 단계는 원형 이미지의 수평 또는 수직 방향의 뒤집기(flip)를 통해 변형 이미지를 형성하는, 앵무새 종 판단방법.
The method according to claim 1 or 2,
The forming of the deformation image from the circular image comprises forming a deformation image through horizontal or vertical flipping of the circular image.
제1항 또는 제2항에 기재된 방법에 의해 얻어진 최종 모델 파일을 저장하는 메모리;
판별 대상 앵무새로부터 비교 이미지를 획득하는 촬영장치;
상기 촬영 장치에 의해 획득한 비교 이미지에 대해 상기 훈련된 웨이트를 이용한 합성곱 신경망 기법을 거쳐 완전 연결층을 형성하고, 상기 완전연결층에 대한 다중분류 활성함수를 이용해 상기 앵무새의 정보를 담은 출력층을 형성하는 프로세서; 그리고
상기 프로세서에 의한 앵무새의 정보를 출력하는 디스플레이;를 구비하는 앵무새 종 판단 장치.
A memory for storing the final model file obtained by the method according to claim 1 or 2;
A photographing device for obtaining a comparison image from the parrot to be determined;
A complete connection layer is formed through a convolutional neural network technique using the trained weight for the comparison image acquired by the photographing device, and an output layer containing the parrot information is generated using a multi-classification activation function for the fully connected layer. Forming processor; And
Parrot species determination apparatus comprising a; a display for outputting information on the parrot by the processor.
삭제delete 삭제delete 삭제delete 삭제delete
KR1020190066883A 2019-06-05 2019-06-05 method and device for classification of parrot KR102211078B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020190066883A KR102211078B1 (en) 2019-06-05 2019-06-05 method and device for classification of parrot

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020190066883A KR102211078B1 (en) 2019-06-05 2019-06-05 method and device for classification of parrot

Publications (2)

Publication Number Publication Date
KR20200140095A KR20200140095A (en) 2020-12-15
KR102211078B1 true KR102211078B1 (en) 2021-02-02

Family

ID=73780526

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020190066883A KR102211078B1 (en) 2019-06-05 2019-06-05 method and device for classification of parrot

Country Status (1)

Country Link
KR (1) KR102211078B1 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007293492A (en) * 2006-04-24 2007-11-08 Omron Corp License plate number recognition device
KR101812953B1 (en) * 2017-06-23 2017-12-29 주식회사 디앤에스 테크놀로지 Image detecting system and method for underbody of vehicle using recognizing a car type by identifying emblem image

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106462978A (en) * 2014-05-07 2017-02-22 日本电气株式会社 Object detection device, object detection method, and object detection system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007293492A (en) * 2006-04-24 2007-11-08 Omron Corp License plate number recognition device
KR101812953B1 (en) * 2017-06-23 2017-12-29 주식회사 디앤에스 테크놀로지 Image detecting system and method for underbody of vehicle using recognizing a car type by identifying emblem image

Also Published As

Publication number Publication date
KR20200140095A (en) 2020-12-15

Similar Documents

Publication Publication Date Title
JP6843086B2 (en) Image processing systems, methods for performing multi-label semantic edge detection in images, and non-temporary computer-readable storage media
US9536293B2 (en) Image assessment using deep convolutional neural networks
KR102220174B1 (en) Learning-data enhancement device for machine learning model and method for learning-data enhancement
Kumar et al. A dataset for quality assessment of camera captured document images
US7983486B2 (en) Method and apparatus for automatic image categorization using image texture
US20160034788A1 (en) Learning image categorization using related attributes
AU2021201933B2 (en) Hierarchical multiclass exposure defects classification in images
JP7131195B2 (en) Object recognition device, object recognition learning device, method, and program
US11430084B2 (en) Systems and methods for saliency-based sampling layer for neural networks
CN101512549A (en) Real-time face tracking in a digital image acquisition device
CN109801275B (en) Potato disease detection method and system based on image recognition
CN111311540A (en) Vehicle damage assessment method and device, computer equipment and storage medium
CN110738103A (en) Living body detection method, living body detection device, computer equipment and storage medium
CN114529873A (en) Target detection method and city violation event monitoring method applying same
Nayef et al. Metric-based no-reference quality assessment of heterogeneous document images
CN116188929A (en) Small target detection method and small target detection system
Khwildi et al. Query-by-example HDR image retrieval based on CNN
CN110942456A (en) Tampered image detection method, device, equipment and storage medium
KR102211078B1 (en) method and device for classification of parrot
CN117275086A (en) Gesture recognition method, gesture recognition device, computer equipment and storage medium
JP2010086466A (en) Data classification device and program
JP6778625B2 (en) Image search system, image search method and image search program
JP2020095526A (en) Image processing device, method, and program
JP2020038572A (en) Image learning program, image learning method, image recognition program, image recognition method, creation program for learning data set, creation method for learning data set, learning data set, and image recognition device
CN114445916A (en) Living body detection method, terminal device and storage medium

Legal Events

Date Code Title Description
E90F Notification of reason for final refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant