Full text
Chapter 3 | Data and Methodology OBJECT DETECTION FOR SINGLE TREE SPECIES IDENTIFICATION WITH HIGH RESOLUTION AERIAL IMAGES Ekanayaka Mudiyanse Ralahamilage Chamodi Lakmali Boyagoda
ii OBJECT DETECTION FOR SINGLE TREE SPECIES IDENTIFICATION WITH HIGH RESOLUTION AERIAL IMAGES Dissertation supervised by Joel Dinis Baptista Ferreira da Silva, PhD Instituto Superior de Estatística e Gestão de Informação, Universidade Nova de Lisboa Lisbon, Portugal Dissertation co-supervised by Pedro da Costa Brito Cabral, PhD Instituto Superior de Estatística e Gestão de Informação, Universidade Nova de Lisboa Lisbon, Portugal Dissertation co-supervised by Filiberto Pla Bañón, PhD Institute of New Imaging Technologies, Universitat Jaume I Castellón de la Plana, Spain February 2020
iii DECLARATION OF ORIGINALITY I declare that the work described in this document is my own and not from someone else. All the assistance I have received from other people is duly acknowledged and all the sources (published or not published) are referenced. This work has not been previously evaluated or submitted to NOVA Information Management School or elsewhere. Lisbon, 17.02.2020 Ekanayaka Mudiyanse Ralahamilage Chamodi Lakmali Boyagoda [the signed original has been archived by the NOVA IMS services]
iv ACKNOWLEDGMENTS I dedicate this paragraph to express my gratitude to persons who helped me to complete my master thesis successfully. Firstly, I would like to express my sincere gratitude to my supervisor Dr. Joel Silva for his continuous knowledge sharing and guidance during master thesis. Secondly, I would like to thank my co-supervisors Prof. Dr. Pedro Cabral and Prof. Dr. Filiberto Bañón for their valuable feedback. Special thank goes to Prof. Marco Painho and Dr. Christoph Brox for their support and guidance throughout the master program. I would like to extend my gratitude to all professors for helping me improve my knowledge on the subject area. Finally, I express my gratitude, love, and respect to my family and friends for their encouragement and support.
v OBJECT DETECTION FOR SINGLE TREE SPECIES IDENTIFICATION WITH HIGH RESOLUTION AERIAL IMAGES ABSTRACT Object recognition is one of the computer vision tasks developing rapidly with the invention of Region-based Convolutional Neural Network (RCNN). This thesis contains a study conducted using RCNN base object detection technique to identify palm trees in three datasets having RGB images taken by Unnamed Aerial Vehicles (UAVs). The method was entirely implemented using TensorFlow object detection API to compare the performance of pre-trained faster RCNN object detection models. According to the results, best performance was recorded with the highest overall accuracy of 93.1 ± 4.5 % and the highest speed of 9m 57s from faster RCNN model which was having inceptionv2 as feature extractor. The poorest performance was recorded with the lowest overall accuracy of 65.2 ± 10.9% and the lowest speed of 5h 39m 15s from faster RCNN model which was having inception_resnetv2 as feature extractor.
vi KEYWORDS Convolutional Neural Network High Resolution Aerial Images Image Classification Object Detection Region-based Convolutional Neural Network Remote Sensing Unnamed Aerial Vehicle
vii ACRONYMS AI – Artificial Intelligence CNN – Convolutional Neural Network DEM – Digital Elevation Model IoU – Intersection over Union ML – Machine Learning NDVI – Normalized Differential Vegetation Index NMS – Non-Maximum Suppression OBIA – Object Based Image Analysis RCNN – Region-based Convolutional Neural Network RF – Random Forest RGB – Red Green Blue RoI – Region of Interest RPN – Region Proposal Network SSD – Single Shot Detector SVM – Support Vector Machine UAV – Unmanned Aerial Vehicles YOLO – You Only Look Once
viii INDEX OF THE TEXT DECLARATION OF ORIGINALITY ................................................................... III ACKNOWLEDGMENTS ...................................................................................... IV ABSTRACT ............................................................................................................. V KEYWORDS ......................................................................................................... VI ACRONYMS ........................................................................................................ VII INDEX OF THE TEXT ...................................................................................... VIII INDEX OF TABLES ............................................................................................... X INDEX OF FIGURES ........................................................................................... XI 1. INTRODUCTION .......................................................................................... 1 1.1 An overview of the work ............................................................................ 1 1.2 Objectives ................................................................................................... 3 1.3 Dissertation Organization ......................................................................... 3 2. LITERATURE REVIEW ............................................................................... 4 2.1 Identification of Tree Species with High Resolution Aerial Images ......... 4 2.1.1 Applications in Agriculture and Crop Management ................................................................ 4 2.1.2 Applications in Forestry Management .......................................................................................... 5 2.2 Applications of Object Detection ................................................................ 6 2.3 Object Detection with Convolutional Neural Network (CNN) ................. 7 2.4 Object detection with R-CNN .................................................................... 9 2.4.1 Region proposals .................................................................................................................................... 9 2.4.2 Feature extraction ............................................................................................................................... 10 2.4.3 Classifier .................................................................................................................................................. 10 2.4.4 Evolution of RCNN Family ............................................................................................................... 11 3. THEORETICAL BACKGROUND .............................................................. 12 3.1 Faster RCNN Architecture ...................................................................... 12 3.2 Pre-trained CNN (Feature Extractor) ..................................................... 12 3.2.1 Inception V2 ........................................................................................................................................... 13 3.2.2 Resnet 50 and Resnet 101 ............................................................................................................... 14 3.2.3 Inception resnet V2 ............................................................................................................................ 15
ix 3.3 Region Proposal Network (RPN) ............................................................. 16 3.3.1 Anchors .................................................................................................................................................... 17 3.4 Region of Interest (RoI) Pooling .............................................................. 17 3.5 RCNN ....................................................................................................... 18 3.6 Training .................................................................................................... 18 4. DATA AND METHOD ................................................................................ 20 4.1 Data Description ...................................................................................... 20 4.2 Method ..................................................................................................... 21 4.2.1 Tools .......................................................................................................................................................... 22 4.3 Pre-processing & labelling ....................................................................... 23 4.4 Training object detection models ............................................................. 24 4.5 Testing trained models ............................................................................ 24 4.6 Accuracy assessment ............................................................................... 25 5. RESULTS .................................................................................................... 26 5.1 Image pre-processing & labelling ............................................................ 26 5.2 Training object detection models ............................................................. 28 5.3 Testing trained models ............................................................................ 28 5.4 Accuracy assessment ............................................................................... 30 6. DISCUSSION .............................................................................................. 33 7. CONCLUSIONS .......................................................................................... 37 BIBLIOGRAPHIC REFERENCES ...................................................................... 38 ANNEX I ............................................................................................................... 42 ANNEX II ............................................................................................................. 46
Chapter 2 | Literature Review 5 images, high accuracy may be achieved by incorporating all bands in the classification (Nomura, 2018). More crowded overlapping oil plam tree crowns can be detected and counted with high resolution multispectral satellite images by training a CNN using thousands of manually labelled samples (Li et al., 2017). In Li et al. (2017), around 9000 samples were used to achieve 96% accuracy of detection with optimum parameter settings as number of kernal in two convolution layers as 30 and 55 and number of hidden units in fully-connected layer as 600. In Csillik et al. (2018), similar accuracy was achieved in identifying citrus trees by training CNN using thousands of training samples derived from UAV multispectral images. Classification accuracy can be improved by applying object-based post processing with results from CNN (Csillik et al., 2018). In Olivares (2019), it is proposed a method to classify UAV images to detect palm trees with reduced number of training samples using pre-trained CNN. However, due to the input size constrain in CNN based feature extractor the detection of induvial palm trees were not possible (Olivares, 2019). The model showed less performance in identifying target tree when it is surrounded by other tree types. 2.1.2 Applications in Forestry Management Remote sensing takes advantage when discriminating tree species from aerial images from the fact that trees share unique spectral signature depending on the type of species they belong to (Lisein et al., 2015). However, spectral signature within and between species changes temporally. In Lisein et al. (2015), it was discovered that the optimal phenological time window for discriminating broadleaved trees lies between late spring and early summer (the end of leaf flushing). During this period, the intra-spectral variation within tree species minimizes while maximizing inter-spectral variation between species (Lisein et al., 2015). In Lisein et al. (2015), tree crowns were manually delineated with help
Chapter 2 | Literature Review 6 of field mapping to input them in automatic object-based supervised RF classifier to identify five tree species based on spectral variation. In Onishi and Ise (2018), it has been exposed in their study that deep learning can distinguish seven tree species with 89.0 % accuracy using individual tree crowns segmented from basic RGB UAV image of forest. This method has benefits in both performance-wise and cost-wise over previous methods which used expensive multispectral images (Onishi and Ise, 2018). However, his model’s accuracy depends highly on the number of training samples per each class and the quality of tree crown segmentation. Although DEM and slope models have been incorporated with increased number of training samples, misclassifications have resulted due to imperfect segmentation. In Safonova et al. (2019), it has also been proved that CNN based classification models have potential to identify four damage stages of Fir trees with an accuracy of 99.7% based on the shape, texture and colour of tree crown in UAV RGB images of mixed forest. Increasing the volume of samples by data augmentation techniques can substantially improve the accuracy of classification when there is relatively small training dataset (Safonova et al., 2019). Although candidate selection technique was adopted to find regions of potential crowns in the image before feeding them in CNN, some misclassifications were resulted. In fact, identifying8 individual tree crowns using only RGB bands is a difficult tasks specially in dense foressts which may be requiring more information such as multispectral bands, NDVI or other spectral indices and 3D LIDAR data (Safonova et al., 2019). Combining small amount of hand annotated high quality tree crwon training data with a large amount of tree crowns autogenerated from LIDAR data by unsupervised algorithm can be used to train CNN to identify individual trees (Weinstein et al., 2019). 2.2 Applications of Object Detection Object detection is a combination of computer vision tasks image classification and object localization to classify and locate the presence of objects
Chapter 2 | Literature Review 7 in an image (Brownlee, 2019). Image classification comprises of algorithms to predict the class of one object in an image. Object localization comprises of algorithms to locate one or more objects present in an image by drawing bounding boxes around them. Accordingly, object detection comprises of algorithms to locate the presence of one or more objects in an image by drawing bounding boxes with labels indicating their class or type of category. These three computer vision tasks are generally referred to as object recognition (Brownlee, 2019). Applications of object detection techniques are visible in various industries such as vehicle detection and counting in transportation industry, building detection in urban planning, face detection and people counting in security purposes and animal monitoring and counting in livestock management. Although ML is widely using in agriculture and forestry industry, a very few studies have been focused on using object detection. ML applications in crop management are found in yield prediction, disease detection, weed detection and species recognition (Liakos et al., 2018). In Arsenovic et al. (2019), object detection was applied to identify diseased leaves in high resolution images proving its capability for the task over traditional ML techniques. Pre-trained object detection models such as Faster RCNN, SSD and YOLOv3 can successfully detect diseased leaves even in complex backgrounds at high accuracy (Arsenovic et al., 2019). 2.3 Object Detection with Convolutional Neural Network (CNN) The most straightforward approach is detecting objects using CNN which is widely used deep learning algorithm in image classification (Sharma, 2018). The following section explains the CNN based on the Stanford University lecture series on CNNs for Visual Recognition (Karpathy, 2019). CNN differs from regular neural networks as it explicitly assumes that the inputs are images. In this way layers in CNN have neurons arranged in three
Chapter 2 | Literature Review 8 dimensions (width, height, depth) which are related to the dimensions of the image (width, height, number of bands). Similarly, the input layer of the CNN has the same dimensions as the input image where width and height are equal to the size of the image and depth is the number of bands in the image (Figure 1). CNN architecture consists of three types of layers; convolutional layers, pooling layer and fully connected layer. Convolutional layers have small spatial filters which convolve across the width and height of input volume computing the dot product between pixel values of the filter and input image at each position during the forward pass resulting a two-dimensional activation map for each filter. This filter shifts over the original image by certain number of pixels called stride. When the stride is one, then the filter shifts by one pixel at a time. After every convolutional operation, non-linear operation called Rectified Linear Unit (ReLU) is introduced to replace negatives values in the feature map to zero. Pooling layers are inserted in between convolutional layers to reduce the spatial size and computational complexity in the network. This is generally done by sliding a filter across the width and height of the input while taking the maximum within the filter which is called as Max pooling. Fully connected layer has all neurons fully connected to the previous layer. It is a Multi-Layer Perceptron using a softmax activation function which keeps the output value ranging from 0 to 1. Once an image is passed through convolution and pooling layers of CNN, it predicts the class of the object in the image as output. Original image is divided into small tile and each tile is fed to CNN so that it predicts the class of each input tile. Later, classified tiles are combined to obtain the classes of all objects in the Figure 1: Layer arrangement of neural network (Karpathy, 2019) Left: layer arrangement of regular neural network. Right: layer arrangement of CNN.
Chapter 2 | Literature Review 9 original image (Sharma, 2018). This kind of straightforward application of CNN requires all objects to share a common aspect ratio (Girshick et al., 2016). Hence, this approach contains problems as objects in an image has different aspect ratios and spatial locations. It is required to utilize thousands of such tiles to overcome that problem resulting more computational time (Sharma, 2018). In Girshick et al. (2016), it is proposed a method called RCNN to address the above problems. 2.4 Object detection with R-CNN Following section describes the architecture of object detection system proposed by Girshick et al., 2016. It has been recognized as the first and most successful CNN approach addressing problems related to object localization, detection and segmentation (Brownlee, 2019). RCNN consists of three modules. They are region proposal, feature extractor and classifier. Region proposals generate category independent regions to consider for feature extraction. Feature extractor extract fixed length vector from each region using CNN. Third module classifies each region into one of the known classes using linear SVM model. The Figure 2 illustrates the overview of object detection system proposed by Girshick et al., 2016. 2.4.1 Region proposals In RCNN, category independent region proposals are generated using selective search method (Girshick et al., 2016). Region proposals are bounding Figure 2: Overview of object detection system (Girshick et al., 2016) (a) It takes image as input. (b) around 2000 region proposals are generated. (c) features are computed for each proposal region using CNN. (d) Each region is classified using class specific linear SVM model (a) (b) (c) (d)
Chapter 2 | Literature Review 10 boxes representing potential objects in an image. Selective search technique proposes Region of Interest (ROI) by recognizing patterns based on the varying scales, colours, textures, and enclosure in the image (Sharma, 2018). Image is initially divided into small segments and combined them to obtain large segments taking into consideration of similarities of scale, colour and texture etc (Sharma, 2018). 2.4.2 Feature extraction Features are the crucial factor in ML modelling techniques which are responsible for generating effective solution when as much as information is extracted from targeted dataset (Dey, 2018). Generally, CNN having architecture of convolutional and pooling layers acts as feature extractors which can be used to extract features before introducing them into ML models such as SVM, RF, etc. (Perone, 2015). Most cases, pre-trained CNNs are utilized as feature extractors by removing last output layer where the process is called transfer learning (Perone, 2015). The features extracted by pre-trained CNN have potential to train ML models to perform classification on very high resolution images (Olivares, 2019). In RCNN, fixed length feature vectors are extracted from each region proposal using CNN developed by Krizhevsky, Sutskever and Hinton, 2012. CNN accepts fixed size of images as input (Girshick et al., 2016). Therefore, pixels surrounded by bounding box of region proposal are warped to get 227 x 227 pixel size image before feeding them into CNN. Input images are passed through five convolutional layers and two fully connected layers. 2.4.3 Classifier After extracting features, regions are classified into known classes using linear SVM. One SVM is trained for each known class by applying extracted features with training labels during the training phase. The performance of the model becomes higher when involving SVM for classification rather than getting the output from last layer of fine-tuned CNN (Girshick et al., 2016).
Chapter 2 | Literature Review 11 2.4.4 Evolution of RCNN Family However, RCNN possesses few drawbacks such as multi-stage training process requiring operation of separate models, requiring a storage of hundreds of gigabytes and slow object detection due to the extraction of features from each region proposal in image (Girshick, 2015). Fast RCNN was introduced to address those issues by reducing training stages to single pipeline. Although, it was fast than RCNN it still requires CNN to pass through region proposals for each image (Girshick, 2015). Faster RCNN which is described in next chapter, is a further improved version to obtain fast and accurate detection model.
Chapter 3 | Theoretical Background 12 3. THEORETICAL BACKGROUND Previous chapter provides an introduction to RCNN. This chapter extensively explains the faster RCNN architecture and feature extractors used in the method proposed in this thesis. 3.1 Faster RCNN Architecture Faster RCNN is an integrated network which shares a deep fully convolutional network known as RPN with state-of-the-art object detection network known as Fast RCNN (Ren et al., 2017). It comprises of four modules namely Pre-trained CNN, RPN, ROI pooling and RCNN as illustrated in Figure 3. Figure 3: Faster RCNN architecture (Rey, 2018) First step is to generate a convolutional feature map from a tensor (multidimensional array) of input image which is fed into a pre-trained CNN. In RPN, predefined number of regions which contain objects are proposed by using fixed sized reference bounding boxes called anchors which are placed on feature map. RoI pooling is applied to extract features of relevant objects (bounding boxes proposed by RPN) from feature map computed by pre-trained CNN. RCNN classifies the object into a class and adjust the bounding box coordinates (Rey, 2018). 3.2 Pre-trained CNN (Feature Extractor) Faster RCNN originally used output of an intermediate layer of VGG which is a CNN trained to classify ImageNet dataset to extract features from input image. It takes the output of convolutional layers by learning edges, patterns and shapes of objects resulting a convolutional feature map of input image which has smaller
Chapter 3 | Theoretical Background 13 spatial dimensions with greater depth than original image (Rey, 2018). Although ZF and VGG were considered as deep networks, much deeper networks have been invented after them. Such networks known as Inception v2, Resnet 50, Resnet 101 and Inception resnet v2 which were used in the study are explained below. 3.2.1 Inception V2 Inception v2 was presented by improving previous version to increase accuracy and reduce computational complexity. Accuracy has been improved by avoiding dimension reduction of input which may lead to loss of information and computational complexity has been reduced by factorizing 5x5 convolution layer to two 3x3 convolution layers (Szegedy et al., 2016). The layer arrangement of inception module is illustrated in Figure 4. Figure 4: Convolutional layer arrangement of inception module (Szegedy et al., 2016) Inception v2 consists of several convolutional and pooling layers with a softmax layer for the final classification (Ioffe and Szegedy, 2015). In faster RCNN inception v2 model, end point has been set to inception (4e) layer for inception v2 to act as a feature extractor. Architecture of inception v2 feature extractor used in the experiment is illustrated in Table 1 assuming input is having spatial dimensions of 224x224.
Chapter 3 | Theoretical Background 14 Type Patch Size/ Stride Output Size Convolution 7×7/2 112×112×64 Max Pool 3×3/2 56×56×64 Convolution 3×3/1 56×56×192 Max Pool 3×3/2 28×28×192 Inception (3a) 28×28×256 Inception (3b) 28×28×320 Inception (3c) Stride 2 28×28×576 Inception (4a) 14×14×576 Inception (4b) 14×14×576 Inception (4c) 14×14×576 Inception (4d) 14×14×576 Inception (4e) Stride 2 14×14×1024 Table 1: Architecture of Inception v2 feature extractor (Ioffe and Szegedy, 2015) 3.2.2 Resnet 50 and Resnet 101 Residual networks have been developed by inserting shortcut connections to the plain networks which were inspired by VGG nets (He, 2015). Shortcut connections are inserted at each block as illustrated in Figure 5. Resnet 50 and Resnet 101 are built by block of layers consisting of 1x1, 3x3 and 1x1 convolutional layers. Detail architecture of Resnet 50 and Resnet 101 with number of blocks are summarized in Table 2. Figure 5: A block of 3 layers with shortcut connection (He, 2015).
Chapter 4 | Data and Method 21 Dataset 3: The dataset consists of one RGB image covering area between Mangapwani and Bumbwini villages on Tanzanian island of Unguja, the main island of Zanzibar. It has been captured using UAV platform on 17 November 2016. The image is having dimensions of 38107 x 42858 pixels at a spatial resolution of 7 cm. The image comprises of areas where the palm trees are sparsely located as well as densely located with the presence of other trees, grasslands, bare land, roads and houses. 4.2 Method This thesis proposed a method to identify and locate palm trees by use of RCNN. The entire method consists of four major steps; image pre-processing and labelling, training object detection models for thesis datasets, testing trained models and accuracy assessment. Figure 10 illustrates complete process in step by step. Figure 10: Methodological Flowchart
Chapter 4 | Data and Method 22 During pre-processing, original images were subjected to format conversion, cropping and objects labelling. Four pre-trained object detection models which are being trained to identify various objects were selected from TensorFlow object detection model zoo. They were trained using pre-processed thesis datasets. Accuracy assessment was conducted by comparing detection results from trained models. All steps were repeated for dataset 1, dataset 2 and dataset 3 separately. Detail explanation of each step is written in section 4.3 to section 4.6. 4.2.1 Tools This section lists out all the software and hardware which were utilized to implement the method proposed in section 4.2. The entire methodology was developed using open source software and packages. • Anaconda is an open source distribution of python aiming to provide various packages and package management tools for scientific computing in data science and machine learning. Anaconda version 2019.07 was installed to manage programming environment for the project. • Python is high level programming language which supports procedural, object-oriented and functional programming allowing users to write easy and logical codes. Python version 3.7.4 was installed inside Anaconda environment. • TensorFlow is an end-to-end open source library for differentiable programming letting users to develop machine learning applications. It can be deployed in platforms like CPUs, GPUs, and TPUs. TensorFlow CPU version 1.14.0 was installed inside Anaconda environment. • TensorFlow Object detection API is an open source framework providing explicitly written collection of codes to build, train and deploy object detection models.
Chapter 4 | Data and Method 23 • LabelImg was used to label objects on image tiles. It is a graphical image annotation tool written in Python. Annotations are written into XML files in PASCAL VOC format used by Imagenet. • Jupyter Notebook is an open-source web application that allows users interactive programming and visualization for scientific computing and data science applications. Jupyter Notebook version 6.0.1 was installed inside Anaconda environment. • All processes were run on a laptop with an Intel i7-8550U CPU @ 1.99 GHz processor, 8 GB RAM and windows 10 64-bit operating system. 4.3 Pre-processing & labelling The purpose of this step was to convert the original images into a form that is compatible with feeding them as input of pre-trained object detection models. TensorFlow object detection models only accept images in PNG/JPG format with three bands i.e. RGB (Huang et al., 2017). Since the original images were in TIF format, they were converted to JPG format using a python script which is attached in Annex II. There is no size limit for the input images of TensorFlow object detection models since only intermediate layer (convolution layers) of pre-trained CNN feature extractor are being used (Rey, 2018). However, input images are resized to 600 x 1024 pixels in faster RCNN models keeping the aspect ratio of images constant to avoid the memory issues may arise during process (Ren et al., 2017). This size has been tested for NVidia Kepler GPU (Szegedy et al., 2016). Nevertheless, faster RCNN expects objects greater than 30 x 30 pixels. Since the average size of targeted objects is around 100 x 100 pixels, original images were cropped into tiles of 1000 x 1000 pixels to keep the size of objects greater than 30 x 30 pixels after resizing. Tiles which are not having palm trees were discarded. 10% of dataset was separated as test images and remaining dataset was split into 70% as train images and 30% as validation images.
Chapter 4 | Data and Method 24 Preparation of datasets for training: All objects (Palm trees) in train and validation images were labelled by drawing bounding boxes using LabelImg. Coordinates of bounding boxes and class were recorded in XML file for each image in the datasets. XML files together with corresponding images were converted to TFRecord format and generated train.record and validation.record files in order to feed them object detection models. Preparation of datasets for accuracy assessment: All objects (Palm trees) in test images were labelled by drawing bounding boxes using LabelImg and coordinates were recorded into XML files. XML files were converted to CSV files and saved as positive ground truth boxes. Likewise, negative ground truth boxes were created by drawing bounding boxes in which palm trees were not presented. 4.4 Training object detection models Four object detection models downloaded from TensorFlow object detection model zoo namely faster_rcnn_inception_v2, faster_rcnn_resnet50, faster_rcnn_resnet101, faster_rcnn_inception_resnet_v2 were trained providing train.record and validation.record prepared in section 4.3 as inputs. Training process was monitored using Tensorboard and terminated when the total loss reached value around 0.1. Inference graph of the model was exported after training was completed. This graph contains the weights of the trained model. Architecture of each model is described in chapter 3. 4.5 Testing trained models Test images were fed into trained model resulted in section 4.4. Detection results were obtained into images in JPG format and coordinates of detection boxes were recorded in CSV file per each test image in dataset. The python script was run in Jupyter Notebook to test models and is attached in Annex II.
Chapter 4 | Data and Method 25 4.6 Accuracy assessment Detection boxes were compared with corresponding positive ground truth boxes and negative ground truth boxes created as explained in section 4.3 to derive metrices; precision, Sensitivity, specificity and accuracy. It was based on the IoU calculated between detection boxes and ground truth boxes. Following definitions were defined for the calculation of metrices; True positives (TP): detection boxes having IoU with positive ground truth boxes > 0.5 False positives (FP): detection boxes having IoU ≤ 0.5 or no intersection with positive ground truth boxes False negatives (FN): ignored ground truth boxes True negatives (TN): negative ground truth boxes having IoU ≤ 0.5 or no intersection with detection boxes Following formulae were considered when computing metrices. Precision = TP TP + FP × 100 = all positives correctly detected by model all positives detected by model Sensitivity = TP TP + FN × 100 = all positives correctly detected by model all positives in actual Specificity = TN TN + FP × 100 = all negatives correctly detected by model all negatives in actual Accuracy = TP + TN TP + FP + TN + FN × 100 = all correctly detected by model all in actual
Chapter 5 | Results 26 5. RESULTS This chapter consists of the outputs resulted from chapter 4. Only selected images are included in this chapter where appropriate. All other results are attached in Annex I. 5.1 Image pre-processing & labelling Dataset 1 consisted of 49 tiles after cropping into 1000 x 1000 pixels of eleven RGB images of 3000 x 4000 pixels. Dataset 2 consisted of 283 tiles after cropping into 1000 x 1000 pixels of RGB image of 17761 x 25006 pixels. Dataset 3 consisted of 432 tiles after cropping into 1000 x 1000 pixels of RGB image of 38107 x 42858 pixels. Number of images after splitting dataset into train, validation and test data is summarized in Table 3. Example of cropped image for each dataset is shown in Figure 11. Data Train Validation Test Dataset 1 31 images 12 images 6 images Dataset 2 179 images 76 images 28 images Dataset 3 276 images 118 images 38 images Table 3: Number of images in train, validation and test data for each dataset Figure 11: Examples of cropped images. (a) example of cropped images from dataset 1, (b) example of cropped images from dataset 2, (c) example of cropped images from dataset 3 (a) (b) (c)
Chapter 5 | Results 27 Example of rectangular bounding boxes drawn using LabelImg is shown in Figure 12. Coordinates of each box recorded in XML file are in order of xmin, ymin, xmax and ymax. Figure 12: Example of labelled image from dataset 1 (a) Example of labelled image from dataset 1, (b) showing a bounding box with coordinates Labels were saved in XML file which contains coordinates of boxes with class. XML files were converted to CSV file format. Number of bounding boxes extracted are indicated in Table 4. The generated TFRecord files from CSV files and corresponding images comprise of numpy array of image with corresponding bounding box coordinates. Data Train Validation Test Palm tree Nonpalm tree Dataset 1 1996 765 441 101 Dataset 2 6121 2743 1240 517 Dataset 3 7158 3056 1433 678 Table 4: Number of bounding boxes extracted from cropped images (xmin, ymin) (xmax, ymax) (a) (b)
Chapter 5 | Results 28 5.2 Training object detection models Training process was terminated when the total loss becomes closer to 0.1. Total loss vs steps graph of faster_rcnn_inception_v2 model for Dataset 1 is shown in Figure 13. Total time durations including training and validation for each model with three datasets were recorded in Tensorboard and are summarized in Table 5. For dataset 1, frcnn_inceptionv2 model was the fastest and frcnn_resnet50 was slightly slower. For dataset 2, frcnn_resnet50 model was faster than other models. For dataset 3, frcnn_inceptionv2 model was the fastest. The frcnn_inception_resnetv2 model had the lowest speed for all three datasets. Overall, frcnn_inceptionv2 was the fastest model among others. Model Dataset 1 Dataset 2 Dataset 3 frcnn_inceptionv2 19m 57s 29m 44s 9m 57s frcnn_resnet50 20m 1s 19m 49s 19m 51s frcnn_resnet101 50m 0s 59m 38s 29m 40s frcnn_inception_resnetv2 5h 39m 15s 5h 0m 19s 5h 22m 51s Table 5: Total time duration for training and validation of each model 5.3 Testing trained models Trained model outputs each input image in which all detections are marked by rectangles with the name of class that object belongs to and confidence that Steps Total loss Figure 13: Total loss vs steps graph of faster_rcnn_inception_v2 model for Dataset 1
Chapter 5 | Results 29 object belongs to identified class. Images in Test folder for each dataset were used to visualize the performance of each model. Such output images from faster_rcnn_inception_v2 model per dataset are shown in Figure 14. It can be seen that in Figure 14 (a), model was not capable of identifying all the objects (Palm trees) in the image. Figure 14 (b) is an example image where shadows of trees have been marked as Palm trees. Figure 14: Classified images from faster_rcnn_inception_v2 model (a) One of the classified images of Dataset 1; (b) One of the classified images of Dataset 2; (c) One of the classified images of Dataset 3 (a) (b) (c)
Chapter 5 | Results 30 5.4 Accuracy assessment Images in the Test folder for each dataset were used to evaluate each model by computing precision, Sensitivity, specificity and accuracy. Total number of bounding boxes manually extracted to utilize as positive (palm trees) and negative (Non-palm trees) ground truth boxes are summarized in Table 4. Figure 15 (a) is an example image showing evaluation results of one of the images in Test folder of dataset 1. Similarly, Figure 15 (b) and (c) illustrate examples for dataset 2 and 3 respectively. Figure 15: Evaluation results of classified images from faster_rcnn_inception_v2 model (a) Evaluation results of one of the classified images of Dataset 1; (b) Evaluation results of one of the classified images of Dataset 2; (c) Evaluation results of one of the classified images of Dataset 3 (a) (b) (c) True positives False positives False negatives True negatives Legend
Chapter 7 | Conclusion 37 7. CONCLUSIONS Crop and forestry management fields often get benefits from a vast range of remote sensing applications to maintain sustainable management. Image classification is one of the important tasks which reveals more information for decision making. Image classification techniques are developing rapidly with the advancement of deep learning. Although, a considerable number of researches have been carried out using CNN in this field and proven its capabilities, very few researches have been conducted to assess the performance of recently developed object detection technique RCNN in agricultural field. This thesis evaluates the performance of faster RCNN in identifying palm trees which may lead to many applications in crop management field. It is also an example of showing the application of RCNN to detect individual trees with a smaller number of training samples. It is evident that pre-trained faster RCNN object detection models can achieve better accuracies with only high resolution RGB images. Faster RCNN models can perform well in identifying target even in complex backgrounds. Object detection models behave differently with different datasets. The speed and performance of models depend on the dataset. It also depends on the type of feature extractor. According the research findings, the faster RCNN model which was having inceptionv2 as feature extractor performed best by achieving the highest overall accuracy and speed. It also well distinguishes shadows from target when compared to other models. The faster RCNN model which was having inception resnetv2 as feature extractor showed poor performance with lowest overall accuracy and speed.
38 BIBLIOGRAPHIC REFERENCES ARSENOVIC, M. et al. (2019) ‘Solving Current Limitations of Deep Learning Based Approaches for Plant Disease Detection’, Symmetry, 11(7), p. 939. doi: 10.3390/sym11070939. BROWNLEE, J. (2019) A Gentle Introduction to Object Recognition With Deep Learning, Deep Learning for Computer Vision. Available at: https://machinelearningmastery.com/object-recognition-with-deeplearning / (Accessed: 17 September 2019). CHIANG, S. H., VALDEZ, M. and CHEN, C. F. (2016) ‘Forest tree species distribution mapping using Landsat satellite imagery and topographic variables with the Maximum Entropy method in Mongolia’, International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences - ISPRS Archives, 41(July), pp. 593–596. doi: 10.5194/isprsarchives-XLI-B8-593- 2016. CSILLIK, O. et al. (2018) ‘Identification of Citrus Trees from Unmanned Aerial Vehicle Imagery Using Convolutional Neural Networks’, Drones, 2(4), p. 39. doi: 10.3390/drones2040039. DEY, S. (2018) CNN application on structured data-Automated Feature Extraction. Available at: https://towardsdatascience.com/cnn-application-onstructured -data-automated-feature-extraction-8f2cd28d9a7e (Accessed: 6 September 2019). GIRSHICK, R. (2015) ‘Fast R-CNN’, Proceedings of the IEEE International Conference on Computer Vision, 2015 Inter, pp. 1440–1448. doi: 10.1109/ICCV.2015.169. GIRSHICK, R. et al. (2016) ‘Region-Based Convolutional Networks for Accurate Object Detection and Segmentation’, IEEE Transactions on Pattern Analysis and Machine Intelligence, 38(1), pp. 142–158. doi: 10.1109/TPAMI.2015 .2437384. GUIRADO, E. et al. (2017) ‘Deep-learning Versus OBIA for scattered shrub detection with Google Earth Imagery: Ziziphus lotus as case study’, Remote Sensing,
39 9(12). doi: 10.3390/rs9121220. HE, K. (2015) ‘Deep Residual Learning for Image Recognition’, ILSVRC2015. HUANG, J. et al. (2017) ‘Speed/accuracy trade-offs for modern convolutional object detectors’, Proceedings - 30th IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, 2017-Janua, pp. 3296–3305. doi: 10.1109/CVPR. 2017.351. HUMBOLDT STATE UNIVERSITY (2019) Object Based Classification, HSU Geospatial Online. Available at: http://gsp.humboldt.edu/OLM/Courses/GSP _216_Online/lesson61/object.html (Accessed: 14 September 2019). ID, J. C., LENG, W. and LIU, K. (2018) ‘Object-Based Mangrove Species Classification Using Unmanned Aerial Vehicle Hyperspectral Images and Digital Surface Models’, Remote Sensing. doi: 10.3390/rs10010089. IOFFE, S. and SZEGEDY, C. (2015) ‘Batch normalization: Accelerating deep network training by reducing internal covariate shift’, 32nd International Conference on Machine Learning, ICML 2015, 1, pp. 448–456. KARPATHY, A. (2019) CS231n Convolutional Neural Networks for Visual Recognition. Available at: http://cs231n.github.io/convolutional-networks/ (Accessed: 3 September 2019). KRIZHEVSKY, A., SUTSKEVER, I. and HINTON, G. E. (2012) ‘ImageNet Classification with Deep Convolutional Neural Networks’, ILSVRC-2012. doi: 10.1201/97814200 10749. LI, W. et al. (2017) ‘Deep learning based oil palm tree detection and counting for high-resolution remote sensing images’, Remote Sensing, 9(1). doi: 10.33 90/rs9010022. LIAKOS, K. G. et al. (2018) ‘Machine learning in agriculture: A review’, Sensors (Switzerland), 18(8), pp. 1–29. doi: 10.3390/s18082674. LISEIN, J. et al. (2015) ‘Discrimination of deciduous tree species from time series of unmanned aerial system imagery’, PLoS ONE, 10(11), pp. 1–20. doi: 10.13 71/journal.pone.0141006. OLIVARES, R. J. L. (2019) PALM TREE IMAGE CLASSIFICATION A convolutional and
40 machine learning approach. ONISHI, M. and ISE, T. (2018) ‘Automatic classification of trees using a UAV onboard camera and deep learning’. Available at: http://arxiv.org/abs/1804 .10390. PERKINS, R. (2016) Engineers Teach Machines to Recognize Tree Species | www.caltech.edu. Available at: https://www.caltech.edu/about/news/engine ers-teach-machines-recognize-tree-species-52122 (Accessed: 19 September 2019). PERONE, C. S. (2015) Deep learning – Convolutional neural networks and feature extraction with Python | Terra Incognita. Available at: http://blog.christian perone.com/2015/08/convolutional-neural-networks-and-feature-extractio n-with-python/ (Accessed: 3 September 2019). REN, S. et al. (2017) ‘Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks’, IEEE Transactions on Pattern Analysis and Machine Intelligence, 39(6), pp. 1137–1149. doi: 10.1109/TPAMI.2016.2577 031. REY, J. (2018) Faster R-CNN: Down the rabbit hole of modern object detection, Tryolabs Blog. Available at: https://tryolabs.com/blog/2018/01/18/faster-r- cnn-down-the-rabbit-hole-of-modern-object-detection/ (Accessed: 12 Octob er 2019). SAFONOVA, A. et al. (2019) ‘Detection of Fir Trees (Abies sibirica) Damaged by the Bark Beetle in Unmanned Aerial Vehicle Images with Deep Learning’, Remote Sensing, 11(6), p. 643. doi: 10.3390/rs11060643. SHARMA, P. (2018) A Step-by-Step Introduction to the Basic Object Detection Algorithms (Part 1). Available at: https://www.analyticsvidhya.com/blog/20 18/10/a-step-by-step-introduction-to-the-basic-object-detection- algorithms-part-1/ (Accessed: 19 September 2019). SHETTY, B. (2018) ‘Supervised Machine Learning: Classification – Towards Data Science’, Toward Data Science. Available at: https://towardsdatascience.com/ supervised-machine-learning-classification-5e685fe18a6d. STEELE, M. (2016) ‘Forest Facts’, Virginia Department of Forestry. Available at:
41 http://www.dof.virginia.gov/edu/resources-educators.htm. SZEGEDY, C. et al. (2016) ‘Rethinking the Inception Architecture for Computer Vision’, Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 2016-Decem, pp. 2818–2826. doi: 10.1109/CV PR.2016.308. SZEGEDY, C. et al. (2017) ‘Inception-v4, inception-ResNet and the impact of residual connections on learning’, 31st AAAI Conference on Artificial Intelligence, AAAI 2017, pp. 4278–4284. TORAHI, A. A. and RAI, S. C. (2011) ‘Land Cover Classification and Forest Change Analysis, Using Satellite Imagery-A Case Study in Dehdez Area of Zagros Mountain in Iran’, Journal of Geographic Information System, 03(01), pp. 1–11. doi: 10.4236/jgis.2011.31001. WEINSTEIN, B. G. et al. (2019) ‘Individual Tree-Crown Detection in RGB Imagery Using Semi-Supervised Deep Learning Neural Networks’, pp. 1–13.
42 ANNEX I This section contains results that were not presented in the main text. Only the images of detection and evaluation results from faster_rcnn_inception_v2 model for dataset 1 are attached here for the reference. Results of all three datasets can be viewed through this link; https://github.com/Chamodi88/MasterThesis . Steps Total loss (a) Total loss Steps (b) Total loss (c) Steps (d) Steps Total loss Total loss (e) Steps Total loss (f) Steps
43 (a) Total loss vs steps graph of faster_rcnn_inception_v2 model for Dataset 1; (b) Total loss vs steps graph of faster_rcnn_resnet50 model for Dataset 1; (c) Total loss vs steps graph of faster_rcnn_resnet101 model for Dataset 1; (d) Total loss vs steps graph of faster_rcnn_inception_resnetv2 model for Dataset 1; (e) Total loss vs steps graph of faster_rcnn_inception_v2 model for Dataset 2; (f) Total loss vs steps graph of faster_rcnn_resnet50 model for Dataset 2; (g) Total loss vs steps graph of faster_rcnn_resnet101 model for Dataset 2; (h) Total loss vs steps graph of faster_rcnn_inception_resnetv2 model for Dataset 2; (i) Total loss vs steps graph of faster_rcnn_inception_v2 model for Dataset 3; (j) Total loss vs steps graph of faster_rcnn_resnet50 model for Dataset 3; (k) Total loss vs steps graph of faster_rcnn_resnet101 model for Dataset 3; (m) Total loss vs steps graph of faster_rcnn_inception_resnetv2 model for Dataset 3 Total loss (g) Steps Total loss (h) Steps Total loss (i) Steps Total loss (j) Steps Total loss (k) Steps Total loss (m) Steps Figure I.I Total loss vs steps graphs of each model
44 Figure I.II Classified images from faster_rcnn_inception_v2 model for test images in Dataset 1 (a) (b) (c) (d) (e) (f) (a) Image 1; (b) Image 2; (c) Image 3; (d) Image 4; (e) Image 5; (f) Image 6;
45 Figure I.III Evaluation results for classification from faster_rcnn_inception_v2 model for test images in Dataset 1 (a) (b) (c) (d) (e) (f) (a) Image 1; (b) Image 2; (c) Image 3; (d) Image 4; (e) Image 5; (f) Image 6;
46 ANNEX II This section contains scripts used to pre-process data and the script used to evaluate the model. All scripts have been uploaded in the following link; https://github.com/Chamodi88/MasterThesis . Figure II.I The python script used for converting image format from TIF to JPG
53 Figure II.III The python script used to detect palm trees and evaluate the detections
Guia para a formatação de teses Versão 4.0 Janeiro 2006