Crab Gender Classification Using Image
Processing, Fuzzy Logic And K Nearest Neighbor
(KNN) Classifier
Cesar Ian A. Baluran, Edwin R. Arboleda, Marivic G. Dizon, and Rhowel M. Dellosa
Abstract: The study aims to determine the gender of a crab with the use of image processing, fuzzy logic, and k-nearest neighbor classifier. The determination of crab gender is usually determined by physical inspection, commonly including claw color and apron shape. The aim of this study is to classify crab gender, specifically blue crab based on image processing and by using fuzzy logic technology and K nearest neighbor classifier. In this study, important crab morphological features such as the surface area of the body of the crab, perimeter, and roundness from 60 image samples have been analyzed to classify male and female crabs’ physical characteristics. To achieve this objective, a fuzzy logic technology, and KNN classifier has been used.
Index Terms: Crab Sexing, Blue swimmer crab, Image Processing, Fuzzy Logic, K Nearest Neighbor —————————— ——————————
1.
INTRODUCTION
Crab farming is an important part of aquaculture in the country. This began in the early seventies when some fishpond operators in Bicol, Visayas, and Southern Tagalog started to culture crab as a subsidiary crop in milkfish or bangus ponds [1]. The blue swimming crabs are common in the Philippines. Half of the blue swimming crab in wild stock in the country comes from the Visayan Sea and Guimaras Strait. Other fishing grounds also contribute to the aggregate annual production of blue swimming crabs. This includes the Asid Gulf, Bohol Sea, Samar Sea, Carigara Bay, Sorsogon Bay, northern part of Ragay Gulf, Tayabas Bay, Malampaya Sound, Panguil Bay, and the waters of Tawi-Tawi in Mindanao[2][3]. The production of blue swimming crab business is the 4th top export products in the Philippines. Currently, from BFAR’s latest statistic, from a quantity of 4,357 tons of crab (live/fresh/frozen/chilled), crab meat and crab fats, the recorded revenue was about 8 Billion Pesos. The number of these exporters presently competing shows how important these resources are to the country’s economy[4]. The increasing export market for crabs has led to increased tax collection in the country. On the other hand, a slight decline in the crab meat market has driven the country on the need for proper management and interest in the establishment of aquaculture. The decreasing stock of the blue swimming crab fishery affects the livelihood of the fishers. In order to protect the blue swimming crab stocks, important sustainability policies governing minimum catch size, responsible fishing gear, closed crabbing seasons and the protection of berried female crabs was ordered. Breeding in hatchery is also considered to increase the production of blue swimming crabs. Management of catching large percentage of the immature
crabs and egg-bearing crabs may help not to decrease the supply of crabs from the waters. The female blue swimming crabs must be freed in case the fishers caches it to lay their eggs first[4][5]. The study may help the blue swimming crabs in terms of management and classification. The brief concept of the study starts from the extraction of the morphological features of the crab samples applying fuzzy logic and KNN classification to automatically determine the gender of the crab. In addition, the study was aimed at creating a computer algorithm that can extract morphological features of the blue swimmer crab and use these values for the implementation of fuzzy logic to automatically determine the gender of the blue swimming crab.
2
RESEARCH
METHODS
2.1 Blue Swimmer Crab
Blue swimmer crabs (talangka, Portunus Pelagicus S.N.) were bought at GenStar Plaza Wet & Dry Market. The images were captured using an Android phone camera equipped with a Sony IMX219 sensor with effective resolution interpolated to 13 Megapixels. Images were stored for later processing using Laptop k Computer of Intel Core i3-6100U up to 2.3 GHz 4 GB RAM and 1 TB hard disk capacity with Microsoft Windows 10 Professional, 64-bit Operating system using MatLab platform.
2.2 Crab Gender Classification System
The proposed approach for the Crab Gender Classification system consists of five parts. After the image acquisition, it will undergo the process of pre-processing the image, image analysis, morphological feature extraction, which will finally undergo the fuzzy logic technique and K Nearest Neighbor Classifier to recognize and classify the crab’s gender accordingly using the following techniques.
Image Acquisition
Samples were taken by placing the samples on a white background. The camera was held in a position normal to the plane of the crab samples at a distance of 12 inches directly over the plane of the sample. Images were stored in JPEG (Joint Photographic Expert Group) format with size 4752 x 2672 pixels[6].
————————————————
Cesar Ian A. Baluran is from Department of Computer and Electronics Engineering, College of Engineering and Information Technology, Cavite State University.
Edwin R. Arboleda is from the Department of Computer and Electronics Engineering, College of Engineering and Information Technology, Cavite State University.
Marivic G. Dizon is from the Department of Computer and Electronics Engineering, College of Engineering and Information Technology, Cavite State University.
Image Analysis
MATLAB (vR2012a) image processing toolbox and mislabels function was used to extract features of crab sample images. After the images of male and female blue swimmer crabs were processed, morphological features were extracted for classification[7].
Morphological Features
The study considered the morphological features of the blue swimming crab to determine its gender. Morphology, on the other hand, deals with the study of the structure and specific structural features of the organisms. Surface area, perimeter, and roundness of the crabs’ body were measured in order to determine its gender. Results were analyzed and these values were used as fuzzy inputs as well as the values fed for the KNN classification[8].
Fuzzy Logic
Fuzzy logic is a rule-based system used for data acquisition and control systems. It can be implemented in hardware or software. Fuzzy logic delivers a simple definite solution when dealing with vague and imprecise input information and is much faster on mimicking how a person would make a decision. It is a type of logic that recognizes the uncertainties of the system. It is more on the determination of degrees of truthfulness. The function of fuzzy logic is to illustrate an input space to an output space[9][10]. After extracting the morphological features of the crab samples, Fuzzy Logic was employed. Morphological features including area, perimeter and roundness were used as fuzzy inputs[11].
K Nearest Neighbor (KNN)
In pattern recognition, the KNN algorithm is a non-parametric method used for regression and classification. The principle of KNN is to find a predefined amount of training samples closest in distance to the new point and predict the classification from the result. The number of samples can be a constant or variable defined by the user. To compute the distance is to use the Euclidean distance[12][13]. This method is known as a non-generalizing machine learning technique. KNN classification in MatLab, A nearest-neighbor classification object, where both distance metric ("nearest") and a number of neighbors can be altered. The object classifies new observations using the predict method. The object contains the data used for training, so can compute resubstitution predictions, will be used to determine the gender of crabs using morphological features[14].
3
RESULT
AND
ANALYSIS
For morphological feature extraction, the captured RGB images of figure 1 were converted into grayscale of figure 2. Thereafter, the edge detection technique was used for easily finding the boundaries of the crab samples within the image. The next step is for the holes in the image to be filled.
Fig 1. Original Image Fig 2. Edges Detected in Image
3.1 Morphological Features Extraction
Morphological features mean the form, structure, and shape of organisms. In the study, three morphological features, including surface area, perimeter, and roundness percentage were calculated. Finally, average values were taken for the classification. In Figure 2, entering the command idx=find((700000 <=area_values)&(area_values<=990000)), will look for all the objects within the image falling in this range, therefore identifying objects as crabs falling within this range. The morphological features described in table 1 were calculated from binary images.
TABLE 1
SAMPLE SHAPE FEATURES (N=60 MALES AND FEMALE CRABS)
Features Male Crab Female Crab
Area 751000-965000
757000-1140000 Perimeter 9000-11000 9200-12000
Roundness 7% to 14% 7% to 15%
3.2 Classification Using Morphology Features
The surface area, perimeter, and roundness percentage are three morphological features are used to determine the gender of the crab with the use of fuzzy logic.
Fuzzy Logic
A membership function (MF defines how each point in the input space is defined to each of the membership value between 0 and 1. The trapezoidal membership functions from the rule structure of the crab gender classification system are the surface area, perimeter, and roundness percentage of the crab sample.
Input Variables
Surface Area of the crab
Perimeter
The perimeter was measured by the number of pixels surrounding the border of the body of the crab.
Roundness
Roundness is the measure of how closely the shape of an object approaches that of a mathematically perfect circle, defined as
R = ((4SAπ)/P^2)*100
TABLE 2
MEMBERSHIP FUNCTIONS FOR SURFACE AREA
Membership Functions Range
Large - FEMALE 1158000 to 1072000 Large - MALE 858000 to 962000 Small - FEMALE 756000 to 840000 Small - MALE 751000 to 804000
TABLE 3
MEMBERSHIP FUNCTIONS FOR PERIMETER
Membership Functions Range
Large - FEMALE 11400 to 14200
Large - MALE 9900 to 12400
Small - FEMALE 9200 to 9400
Small - MALE 8600 to 9800
TABLE 4
MEMBERSHIP FUNCTIONS FOR ROUNDNESS
Membership Functions Range (%)
Large - FEMALE 14.5 to 6.3
Large - MALE 10.55 to 14.22
Small - FEMALE 6.97 to 9.76
Small - MALE 5.04 to 8.31
Output Variables
The fuzzy logic algorithm will be used for the crab gender classification. The combination of input variables will determine the sex of the crab.
TABLE 5
FUZZY RULE BASE FOR THE CRAB GENDER CLASSIFIER
Area Perimeter Roundness Gender
Large-Female Large-Female Large-Female Female
Large-Female Large-Female Small-Female Female
Large-Female Large-Female Large-Male Female
Large-Female Large-Female Small-Male Female
Large-Female Small-Female Large-Female Female
Large-Female Small-Female Small-Female Female
Large-Female Small-Female Large-Male Female
Large-Female Small-Female Small-Male Female
Large-Female Large-Male Large-Female Female
Large-Female Large-Male Small-Female Female
Large-Female Small-Male Large-Female Female
Large-Female Small-Male Small-Female Female
Small-Female Large-Female Large-Female Female
Small-Female Large-Female Small-Female Female
Small-Female Large-Female Large-Male Female
Small-Female Large-Female Small-Male Female
Small-Female Small-Female Large-Female Female
Small-Female Small-Female Small-Female Female
Small-Female Small-Female Large-Male Female
Small-Female Small-Female Small-Male Female
Small-Female Large-Male Large-Female Female
Small-Female Large-Male Small-Female Female
Small-Female Small-Male Large-Female Female
Small-Female Small-Male Small-Female Female
Large-Male Large-Female Large-Female Female
Large-Male Large-Female Small-Female Female
Large-Male Small-Female Large-Female Female
Large-Male Small-Female Small-Female Female
Small-Male Large-Female Large-Female Female
Small-Male Large-Female Small-Female Female
Small-Male Small-Female Large-Female Female
Small-Male Small-Female Small-Female Female
Large-Female Large-Male Large-Male Male
Large-Female Large-Male Small-Male Male
Large-Female Small-Male Large-Male Male
Large-Female Small-Male Small-Male Male
Small-Female Large-Male Large-Male Male
Small-Female Large-Male Small-Male Male
Small-Female Small-Male Large-Male Male
Small-Female Small-Male Small-Male Male
Large-Male Large-Female Large-Male Male
Large-Male Large-Female Small-Male Male
Large-Male Small-Female Large-Male Male
Large-Male Small-Female Small-Male Male
Large-Male Large-Male Large-Female Male
Large-Male Large-Male Small-Female Male
Large-Male Large-Male Large-Male Male
Large-Male Large-Male Small-Male Male
Large-Male Small-Male Large-Female Male
Large-Male Small-Male Small-Female Male
Large-Male Small-Male Large-Male Male
Large-Male Small-Male Small-Male Male
Small-Male Large-Female Large-Male Male
Small-Male Large-Female Small-Male Male
Small-Male Small-Female Small-Male Male
Small-Male Large-Male Large-Female Male
Small-Male Large-Male Small-Female Male
Small-Male Large-Male Large-Male Male
Small-Male Large-Male Small-Male Male
Small-Male Small-Male Large-Female Male
Small-Male Small-Male Small-Female Male
Small-Male Small-Male Large-Male Male Small-Male Small-Male Small-Male Male
Inference Method
For the crab gender classifier, Mamdani Inference Method was used. Mamdani's method utilizes a fuzzy set for control systems. Ebrahim Mamdani was the one who introduced this technique to control a steam engine. On the other hand, Mamdani's idea was taken from the father of fuzzy logic Lotfi Zadeh's who wrote a paper in 1973 about fuzzy algorithms for complex systems. Mamdani's method has simple structure of 'min-max' operations. Additionally, this inference, as defined for the toolbox, expects the output membership functions to be fuzzy sets. After the aggregation process defuzzification takes place.
3.3 K Nearest Neighbor Classifier
TABLE 6
RESULTS OF CLASSIFYING THE CRABS’ GENDERS USING KNN
K FEMALE MALE MEAN
1 100 100 100
2 100 100 100
3 63.33 90 76.665
4 70 100 85
5 70 100 85
6 63.33 100 81.665
7 63.33 90 76.665
8 63.33 100 81.665
9 63.33 100 81.665
10 70 100 85
Table 6 shows the result of the KNN classification of male and female blue swimmer crabs. The proposed KNN classifier has a high percentage classification for the male crabs, it almost got the perfect classifications. The results are gathered from 60 samples. 30 male and 30 female blue swimmer crabs images.
4 CONCLUSION
In this study, the researcher attempts the implementation of image processing for the classification of blue swimmer crabs (Portunus pelagicus) gender by the use of fuzzy logic and K nearest neighbor. The study introduces an imaging technique used for the morphological features extraction of the crab samples and fuzzy logic algorithm and K nearest neighbor classification based on the values gathered. The
implementation of Image Processing, Fuzzy Logic and KNN Classifier with the help of MATLAB programming, vislabels function, and fuzzy logic toolbox, gender classification of crabs will be faster and more efficient. The experimental result indicates that our algorithm is effective with an accuracy of 85% (k=10) on gender classification. However, the researcher recommends future studies to have more samples for more accurate results.
REFERENCES
[1] Entrepinoys, ―Mud Crab Culture, Part 2 Managing Farm and Practices,‖ 2013. [Online]. Available: https://ep.franphil.com/mud-crab-culture-managing-farm-and-fattening-practices/. [Accessed: 14-Jan-2019].
[2] M. T. De Cruz, J. O. De Cruz, I. L. Tan, and E. K. Ruizo, ―The Blue Swimming Crab ( Portunus pelagicus ) Fishery of Eastern Visayas, Philippines,‖ Philipp. J. Nat. Sci., vol. 1, pp. 25–45, 2015.
[3] DA-BFAR, ―In Turbulent Seas : The Status of Philippine Marine Fisheries,‖ 2003. [Online]. Available: https://www.bfar.da.gov.ph/new/announcement_archiv e/1Final Approved Version BSCMP January 24 2013.pdf.
[4] ―Philippine Blue Swimming Crab Fisheries Improvement Project (FIP) Workplan 2017-2018,‖
2018. [Online]. Available:
https://drive.google.com/file/d/0BxvEZQ7Taa56Qk5KS mJydmpCXzg/view. [Accessed: 15-Jan-2019].
[5] ―Blue swimming crab,‖ Monterey Bay Aquarium, 2018. [Online]. Available: https://www.seafoodwatch.org/-/m/sfw/pdf/reports/c/mba_seafoodwatch_philippineswi mmercrabreport.pdf.
[6] E. R. Arboleda, ―Comparing Performances of Data Mining Algorithms for Classification of Green Coffee Beans,‖ Int. J. Eng. Adv. Technol., vol. 8, no. 5, pp. 1563–1567, 2019.
[7] E. R. Arboleda, A. C. Fajardo, and R. P. Medina, ―An Image Processing Technique for Coffee Black Beans Identification,‖ in 2018 IEEE International Conference on Innovative Research and Development (ICIRD), 2018, no. May, pp. 1–5.
[8] E. R. Arboleda, A. C. Fajardo, and R. P. Medina, ―Classification of Coffee Bean Species Using Image Processing, Artificial Neural Network, and K Nearest Neighbors,‖ 2018 IEEE Int. Conf. Innov. Res. Dev., no. May, pp. 1–5, 2018.
[9] K. E. N. T. Rabe, E. R. Arboleda, and R. M. Dellosa, ―Fuzzy Logic Based Vehicular Congestion Estimation Monitoring System Using Image Processing And KNN Classifier,‖ Int. J. Sci. Technol. Res., vol. 8, no. 08, pp. 1377–1380, 2019.
[10] A. E. Andaya, E. R. Arboleda, A. A. Andilab, and R. M. Dellosa, ―Meat Marbling Scoring Using Image Processing with Fuzzy Logic Based Classifier,‖ Int. J. Sci. Technol. Res., vol. 8, no. 08, pp. 1442–1445, 2019.
[11] C. L. Macalalad, E. R. Arboleda, A. A. Andilab, and R. M. Dellosa, ―Morphological Based Grain Comparison of Three Rice Grain Variety,‖ Int. Journal Sci. Technol. Res., vol. 8, no. 08, pp. 1446–1450, 2019.
Need Hundreds of Classifiers to Solve Real World Classification Problems?,‖ J. Mach. Learn. Res., vol. 15, pp. 3133–3181, 2014.
[13] L. I. Kuncheva, Base Classifiers. Wiley, 2004.