School of Science and Technology 科技學院
Computing Programmes 電腦學系

A Bird Recognizer based on Particle Swarm Optimization

Ho Ting Hong Tomy

Programme Bachelor of Science with Honours in Computing
Supervisor Dr. Vanessa Ng
Areas Artificial Intelligence and Intelligent Systems
Year of Completion 2013

Objectives

The aim of this project is to develop a bird recognizer based on particle swarm optimization. Our target is to recognize the 21 kinds of common wild birds seen in Hong Kong urban parks which are listed by Leisure and Cultural Services Department of the Hong Kong Government. It is developed based on the particle swarm optimization and is a kind of application of it. Some kinds of recognition methods have been designed to increase the hit rate in recognition based on particle swarm optimization.

To achieve the aim, a bird recognizer with different kinds of recognition methods have built and some is based on particle swarm optimization. Advantage of particle swarm optimization was researched. On entering a bird image into the program, a bird result should be returned. The project has also defined following sub-objectives:

  • Investigate on machine learning algorithms
  • Create GUI for showing the structure of the algorithm
  • Design of bird recognizer
  • Train and test the bird recognizer

Background and Methodology

In solving problems, we always expect a fastest optimal solution, computing science is a way helping human solve complex problems and artificial intelligence is a branch of it which will take action to maximize the success rate in solving problems. Machine learning which is a branch of artificial intelligence, it has the ability to remember the experience in training or problems so that an optimal solution can be found faster in relevant problems. Neural network and Genetic Algorithm share a great part in machine learning.

Inside particle swarm optimization, a list of random particle is generated, then the particles are inserted into the fitness function which we use it to solve our problem. For every particle, there is a result. Then the resulting particles compare their position with the particles nearby. On updating their position, they will know which particle has the best position and the particles will optimize right there.

For body structure recognition, we need to use to input 7 points on the bird image they chose. The 7 points are at mouth tip, mouth root, back of head, top of head, back of neck, hip and tail tip. On clicking those points on the screen, the program can get the X-Y coordinate of the points at the image. Then the points are used for further calculation. The following shows the 7-points to find out the body structure:

For having 7 points, we link them together then the distance between points will be calculated. The distances are representing the body length of the bird. They are 6 data can be obtained, all of them are divided by the minimal number between them and a ratio of them will be obtained. Those 6 digits can form the bird structure ID which can represent the bird structure data. This ID is useful since although there is a small error in user input, the ID still can used to distinguish the structures. For example Spotted Dove have a long neck, the 4th digit of the ID will be a large number. For Blue Magpie, it has a long tail, so the 6th digit of ID will be a large number. For red whiskered Bulbul, it has a long head so the 3rd digit of ID will be a large number. Since the program has already trained some structure ID to it, so it has learned to distinguish the structure by ID.

There is a wide range of structure ID was trained to the program. The training ID is grouped by each kind of birds. For finding out the closest structure ID relative to the input ID, the particle swarm optimization which insert an equation for calculating the difference will be used. The algorithm is inserted is Fitness = sqrt ((p1-x1) ^2+……… (p8-x8) ^2), on entering a different ID, the trained particle swarm optimization will solve the difference and get the closest ID. Since the ID was stored by type, so we know which kind of bird structure it is. The advantage of using particle swarm optimization is that it is easy to be implemented, it can use to solve this problem by finding out a suitable equation to insert to it. And different from normal searching, every particle in swarm runs parallel, so the result can be reached faster. And different from the original particle swarm optimization which particles start in a random position, our particles start of the training, this helps to reduce some redundant searching. The following shows the resultant program of body structure recognizer:

The following shows the body structure example of a Red-whiskered Bulbul:

The length from mouth tip to mouth root is 2cm. The length from mouth root to head back is 2cm. The length from the head back to head top is 4cm. The length from head back to neck back is 2cm. The length from back neck to hip is 9cm and the length from hip to tail tip is 6cm. By getting the ratio of these 6 lengths, we can obtain a ratio 2:2:4:2:9:6. Then we search the smallest number in the ratio, which is 2 in this example. Then we do a calculation by dividing the ratio by this smallest number, the result is 1:1:2:1:4:3 with rounding the digit after dividing it. Adding up the digit into an array, it becomes an integer and we can use it for comparison and calculation in particle swarm optimization.

Particles in particle swarm optimization are trained with the structure ID of each kind of birds. Then particles start searching at different ID position.

In a random searching field, the closest particle can reach our ID input in the shortest distance, so particles optimize right there. Since structure IDs are stored in different types of birds, so we can know that what kind of bird structure it is after having the ID. And the body structure is of Red- whiskered Bulbul.

Texture recognition is a kind of image searching method used by Google in image searching. By using the Perceptual Hashing method, the image input will be processed and the simulation ratio will be calculated. Since we observed that some birds have patterns on their body such as tree sparrow, so searching by this method can recognize them out.

Same as color recognition, the texture recognition needs a crop of the image to reduce the error affected by the background of the image. Then smaller the size of the crop part, it is then used to calculate the average gray color and obtain a finger print of it. The fingerprint is then compared with the fingerprint trained into the program. The simulation rate is then returned and this finger print has 63.7% simulated to the fingerprint of Red-whiskered Bulbul, so this is Red-whiskered Bulbul. An example is shown below:

Evaluation

In the following, there are two parts of testing for testing the recognizing rate of the recognizer. The first part is testing of training data, the second part is testing of testing data. The testing is divided into two parts, the first part is after we enter a target bird, the recognizer has to return a result list contain the correct bird. The second part of the testing is entering a bird which is not our target, the program should not return our target bird. The first part is considerate as true testing part of this testing which represented by T and the second part is considerate as the false testing part of testing which represented by F. Each part shares 50% of the final result. By adding up the percentage, we can have the result percentage of recognition.

In calculating the average of the above total percentage of each bird, the average percentage of recognizing the training data is 88.09%. There are totally 210 training data were used in this testing. 8 kinds of bird can be recognized with a maximum rate of 100% which are Koel (Male), Oriental Magpie Robin, White-rumped Munia, Black-collared Starling, Common Magpie, Blue Magpie, Japanese White-eye, Alexandrine Parakeet. These kinds of birds have a color that is unique and easy to be distinguished. Most of the birds with 100% rate are in blue stream, since blue stream contains 5 kinds of birds only. It is easy for bird in blue stream being recognized correctly. Only Oriental Magpie Robin and Common Magpie look similar in blue stream, Blue Magpie has a specific blue color that is easy to be recognized. For Japanese White-eye, since it is in green color clearly, so it has a specific HSV value compared to other types. This makes it has a high recognizing rate. For White-rumped Munia, it has a clear net pattern on its net so this makes it texture easy to be recognized. There are 3 kinds of birds have a minimum recognition rate of 70% which are Spotted Dove, Feral Pigeon, Yellow-crested Cockatoo. Since Spotted Dove and Feral Pigeon have close structure, it is easy to get a wrong result between them. And for Yellow-crested Cockatoo, since there are difficulties in the program in recognizing the white color, the whole white body makes the recognizer have difficulty in recognizing it. Since this is a testing using the training data of the recognizer, so it should have a high recognizing rate.

This is the result of bird recognizer without particle swarm optimization. By calculating the average of the above total percentage of each bird, the percentage of recognizing the testing data is 70.95% .There are totally 210 training data were used in this testing. 1 kinds of bird can be recognized with a maximum rate of 100% which is the Alexandrine Parakeet . Since only the Alexandrine Parakeet is in the green color stream in RGB recognition, so Alexandrine Parakeet always has the recognizing rate of 100%. There are 2 kinds of birds have a minimum recognition rate of 20% which are Feral Pigeon and Yellow-crested Cockatoo. Since the structure characteristic of Feral Pigeon is similar to Spotted Dove, without particle swarm optimization the recognizer was weakened and cannot distinguish them. The other kind is Yellow-crested Cockatoo, which has a structure close to Alexandrine Parakeet. But not like the Alexandrine Parakeet, the color of Yellow-crested Cockatoo is no so special to the recognizer, so it has a low recognizing rate after the particle swarm optimization was removed.

This is the result of time comparison between recognizer with particle swarm optimization and without particle swarm optimization. 210 of testing data were used and the average searching time of each type was calculated. Bird recognizer with particle swarm optimization has a faster searching time in 15 kinds of birds then bird recognizer that without particle swarm optimization. Which means that particle swarm optimization can make the bird searching process faster. The average searching time was improved from 0.613 to 0.599.

Conclusion and Future Development

The aim of this project is to construct a bird recognizer based on particle swarm optimization which can recognize 21 kinds of common wild birds seen in Hong Kong urban parks which are listed by Leisure and Cultural Services Department of the Hong Kong Government. After design and implement of different recognition method, the aim is achieved and the particle swarm optimization was successfully implemented to the recognizer. All the targets in the objective are finished and a system of bird recognizer is the result.

Methods are all finished as the design which are enough to recognizing a bird. The resulting recognizing rate is satisfaction after the implementation of the methods. Birds are now can be recognized by input an image and this makes bird viewers having more fun.

There are some assumptions were made when designing the methods which will affect the precision of the result. If these assumptions were not made, it is hard for us to create methods for recognizing birds.

There are a few limitations of the input image. Firstly, the bird should face to the left side. Since the texture recognizer needs an bird input is facing the same side, facing in different angle leads to an error in recognition. The recognizer will considerate it as a different image. Second, the bird photo which takes in a normal situation gives a better rate. If the color is too bright or too dark, the recognition in color recognition should be affected. But this does not affect the recognizing rate too much since combining the data of RGB and HSV, the color data are very enough to distinguish a bird. Third is the limitation of clicking the structure points. Since it is hard to create a system which can obtain the structure points automatically, we need the users to input them. The users have to learn about it but it seems to be easy for users handling it. Forth is a crop of image by the user, if crop done by users contain the background image, the result should get error easily. So crop the image correctly is a limitation. Last is the import of image, this system is mainly for designing the method of recognition, so it is not so user friendly that we have to modify the program code when change the input image.

Although the bird recognizer is developed with 3 methods that for recognizing birds, there are many improvements can be done to make it perfect. The following are improvements can be made in the future.

Copyright Ho Ting Hong Tomy and Vanessa Ng 2013

Jonathan Chiu
Marketing Director
3DP Technology Limited

Jonathan handles all external affairs include business development, patents write up and public relations. He is frequently interviewed by media and is considered a pioneer in 3D printing products.

Krutz Cheuk
Biomedical Engineer
Hong Kong Sanatorium & Hospital

After graduating from OUHK, Krutz obtained an M.Sc. in Engineering Management from CityU. He is now completing his second master degree, M.Sc. in Biomedical Engineering, at CUHK. Krutz has a wide range of working experience. He has been with Siemens, VTech, and PCCW.

Hugo Leung
Software and Hardware Engineer
Innovation Team Company Limited

Hugo Leung Wai-yin, who graduated from his four-year programme in 2015, won the Best Paper Award for his ‘intelligent pill-dispenser’ design at the Institute of Electrical and Electronics Engineering’s International Conference on Consumer Electronics – China 2015.

The pill-dispenser alerts patients via sound and LED flashes to pre-set dosage and time intervals. Unlike units currently on the market, Hugo’s design connects to any mobile phone globally. In explaining how it works, he said: ‘There are three layers in the portable pillbox. The lowest level is a controller with various devices which can be connected to mobile phones in remote locations. Patients are alerted by a sound alarm and flashes. Should they fail to follow their prescribed regime, data can be sent via SMS to relatives and friends for follow up.’ The pill-dispenser has four medicine slots, plus a back-up with a LED alert, topped by a 500ml water bottle. It took Hugo three months of research and coding to complete his design, but he feels it was worth all his time and effort.

Hugo’s public examination results were disappointing and he was at a loss about his future before enrolling at the OUHK, which he now realizes was a major turning point in his life. He is grateful for the OUHK’s learning environment, its industry links and the positive guidance and encouragement from his teachers. The University is now exploring the commercial potential of his design with a pharmaceutical company. He hopes that this will benefit the elderly and chronically ill, as well as the society at large.

Soon after completing his studies, Hugo joined an automation technology company as an assistant engineer. He is responsible for the design and development of automation devices. The target is to minimize human labor and increase the quality of products. He is developing products which are used in various sections, including healthcare, manufacturing and consumer electronics.

Course Code Title Credits
  COMP S321F Advanced Database and Data Warehousing 5
  COMP S333F Advanced Programming and AI Algorithms 5
  COMP S351F Software Project Management 5
  COMP S362F Concurrent and Network Programming 5
  COMP S363F Distributed Systems and Parallel Computing 5
  COMP S382F Data Mining and Analytics 5
  COMP S390F Creative Programming for Games 5
  COMP S492F Machine Learning 5
  ELEC S305F Computer Networking 5
  ELEC S348F IOT Security 5
  ELEC S371F Digital Forensics 5
  ELEC S431F Blockchain Technologies 5
  ELEC S425F Computer and Network Security 5
 Course CodeTitleCredits
 ELEC S201FBasic Electronics5
 IT S290FHuman Computer Interaction & User Experience Design5
 STAT S251FStatistical Data Analysis5
 Course CodeTitleCredits
 COMPS333FAdvanced Programming and AI Algorithms5
 COMPS362FConcurrent and Network Programming5
 COMPS363FDistributed Systems and Parallel Computing5
 COMPS380FWeb Applications: Design and Development5
 COMPS381FServer-side Technologies and Cloud Computing5
 COMPS382FData Mining and Analytics5
 COMPS390FCreative Programming for Games5
 COMPS413FApplication Design and Development for Mobile Devices5
 COMPS492FMachine Learning5
 ELECS305FComputer Networking5
 ELECS363FAdvanced Computer Design5
 ELECS425FComputer and Network Security5