Sei sulla pagina 1di 6

Early Fertility Classification of Broiler Eggs through

Pattern Recognition using Histogram of Oriented


Gradients and Support Vector Machine
Gracelle A. Buado John Carlo D. Corpuz Gian Carlo V. Suarez Dunhill Jan C. Vilardo
Department of Electronics Department of Electronics Department of Electronics Department of Electronics
Engineering Engineering Engineering Engineering
Mapua University Mapua University Mapua University Mapua University
Manila, Philippines Manila, Philippines Manila, Philippines Manila, Philippines
gabuado@mymail.mapua.edu.ph jcdcorpuz@mymail.mapua.edu.ph gcvsuarez@mymail.mapua.edu.ph djcvilardo@mymail.mapua.edu.ph

Abstract— This research aims to build a device which destructive and accurate method of detecting the fertility of eggs
determines the fertility of a laid broiler egg for provincial hatchery after 10 days of incubation. They applied image processing that
farms within 4 to 8 days of being laid. The eggs are classified as made use of an inspection chamber which composed of a camera
fertilized or unfertilized egg where fertilized egg are eggs that has connected to a computer with MATLAB Software. Separation
an evidence of growth such as presence of web-like structures of egg’s fertility will be done by notifying the human sorter.
which pertains to its blood vessels and has a possibility of hatching;
unfertilized eggs were eggs which does not exhibit growth and From the previous related study, we have observed that their
remained to be a clear egg from the day it was laid – such as eggs materials were not economically practical to apply in a
having an absence of blood vessels. The system also detects blood provincial hatchery farm since they made use of costly
ring pattern that signifies unhatchable egg which is also components such as PLC for their microcontroller and
considered as unfertilized egg. The device will capture the egg and MATLAB for their software. Those materials will also occupy
will detect its fertility by pattern recognition using Histogram of space supposedly meant for incubators considering the
Oriented Gradients (HOG) and Support Vector Machine. The raw MATLAB Software that requires a computer with Windows
image of the egg will undergo image grayscaling, pattern Operating System. However, in our study we will determine
extraction, and computation of gradient image before it classifies egg’s fertility internally through pattern recognition of the image
the fertility. If the detected image forms a web-like structure, it captured by our camera connected to our Raspberry Pi using
will signify that the egg is fertilized while a blood ring and clear
HOG feature extraction and classification by Support Vector
egg signifies unfertilized. The result will be displayed in the GUI.
Machine. The system also includes equipment that will separate
Keywords—fertilized egg, unfertilized egg, web-like structure, the fertilized and unfertilized eggs with the use of a conveyor
blood ring belt; thus, we can less human effort and avoid possible
pathogenic bacteria contamination without sacrificing the
I. INTRODUCTION quality of the sample.
According to the article made by Philippine Star, a bird flu The objective of this study is to develop a system that would
outbreak happened in Luzon last 2017. This led to a decrease in determine and detect the fertility of the broiler chicken eggs
chicken production since a number of poultry farms and through pattern recognition via Histogram of Oriented Gradient
hatcheries’ fowls were culled and buried. Fertilized egg from (HOG) feature extraction of the preprocessed image and Support
hatcheries plays an important role in the Philippine’s chicken Vector Machine (SVM). These are the specific objectives that
production. Only broiler chicken provides fertilized eggs since the researchers would like to achieve: (1) To make a conveyor
layer chickens only composed of laying hens which can only system for sorting eggs in bins labeled fertilized and unfertilized.
produce unfertilized egg used as table eggs. Its early fertility (2) To extract features of patterns such as web-like structure,
classification will not only help hatchery farms to prevent blood ring, and clear image structure inside the egg using image
contamination of fertilized eggs but also maximize time, space, segmentation and Histogram of Oriented Gradient (HOG)
and cost that can be spent in the incubation process meant for feature extraction. (3) To determine which of the eggs are
fertilized eggs; this will also help their farmers to determine fertilized and unfertilized through Support Vector Machine
egg’s fertility accurately since their common method in (SVM) Classifier. (4) To create a Graphical User Interface
detecting fertilized egg from unfertilized egg is candling method (GUI) that will display the egg’s fertility.
which is labor consuming and can be prone to error due to a
farmer’s possible boredom, eye strain or tiredness. Egg fertility classification would help lessen the workload
and would allow poultry farmers to have an accurate system for
A study “A MATLAB-Based System for the Determination eggs needed to produce and sell to the market daily. This will
of Duck Egg Fertility from the Formation of Blood Vessels lessen the common candling method wherein they incubate the
Using Frangi Filtering Method” (2013) aims to develop a non- eggs for 21 days and candling it multiple times in order to verify
the egg development. This study saves time and cost that can be
spent in the incubation process which were supposedly meant
for fertilized eggs by separating it from unfertilized egg before
putting into the incubator. This can also help the avoidance of
hatchable fertilized eggs contamination from pathogenic
bacteria or rotten unfertilized.
The scope of this system is to determine whether the egg in
test is fertilized or not through image processing. Fertilized eggs
will have spots and web-like structures indicating that an
embryo is present. The system, on the other hand, does not make
accurate output in cases wherein an egg has a dirty shell. The
eggshell may sometimes be covered in dry blood or dirt which
may hinder the system to process the results accurately. Second, Fig. 2. Hardware Circuit Diagram.
in the case of an egg’s early days, an egg’s fertility is commonly
confirmed within 4 to 8 days after being laid by the chicken. Fig. 2 shows the hardware’s microcontroller circuit
Processing the egg right after being laid will most likely state diagram. The overall hardware features the use of camera for
that the egg is unfertilized even if it is not. Putting eggs in the the image processing, a servomotor, an IR sensor, a power
tray before processing were done by hand to minimize breakage. supply, a microcontroller unit, a relay switch, and an LCD
Lastly, after the egg has been proven that it is indeed a fertilized monitor for the output. The system is mainly power through an
egg, the system will no longer be involved in the detection of the AC outlet (220V).
embryo’s health and growth up until the moment it hatches.
B. System Set-up
II. METHODOLOGY The experiment will be conducted in controlled environment
A. Conceptual Framework that is properly ventilated. The sample will be placed on the
socket; the camera will take an image of the egg sample when
Input: Image of the Egg on the Egg Socket.
the sorter clicks the “START” button of the system. After that,
Process: Image Grayscaling to simplify the Image
the system will automatically detect if the captured image of the
sample is fertilized or unfertilized. The conveyor belt will
Process: Pattern Extraction using Histogram of Oriented Gradients continue moving until it reached the IR Sensor. If the detected
image is fertilized, the conveyor will continue moving until the
Process: Classifying the Egg Fertility (Fertilized/Unfertilized) by SVM egg was placed to the ramp of fertilized egg. However, if the
Process: Proximity Sensor to Halt Mechanical Process for Decision
detected image is unfertilized, the flipper will move in order to
move the egg to the unfertilized egg ramp. Fig. 3 shows the set-
Process: Servomotor up of the system where the sample is to be placed.
Output: GUI will display Egg Fertility (Fertilized/Unfertilized)

Output: Sorted Fertilized and Unfertilized Egg

Fig. 1. Conceptual Framework of the process.

Fig. 1 shows the conceptual framework of the process. The


process requires a picture of an egg for the input. The picture of
the egg will then be processed by applying image thresholding Fig. 3. Egg position on the light source.
wherein each color will be subject to comparison with the
threshold value. After that, the image will undergo grayscaling
to simplify the image of which it will then be subject to the
extraction of Histogram of Oriented Gradients (HOG) feature.
Support vector machine (SVM) will be applied to serve as a
classifier for the eggs’ image processing. The machine will be
trained by feeding it numerous images of eggs, both fertilized
and unfertilized. For the operational interface, containers
labeled unfertilized and fertilized, respectively, will be placed
in the sorting area. After all the process has been accomplished,
the eggs will be fully sorted into whichever bin they belong to.
Fig. 4. The device set-up.
1) Hardware Block Diagram: Figure illustrates the flow of
Shown in Fig. 4 is the over-all device set-up of the system
connections of each device which can be used in analyzing the which includes the monitor where the GUI will be displayed. It
flow of devices. also includes mouse and keyboard as the controller for the
system.

2
C. System Flowchart

Fig. 6. Image Segmentation and Feature Extraction.

2) Histogram of Oriented Gradients (HOG): For feature


extraction, the Histogram of Oriented Gradient (HOG) feature
will be used. It encodes the pixel’s information and the
directionality of the pixel’s information. Figures show the
sample HOG feature extraction of Fertilized, Unfertilized
(Blood Ring), Unfertilized (Clear Egg) Samples (Fig. 7).

Fig. 5. System Flowchart.

In Fig. 5, it shows how the system is intended to work. It


begins with taking picture of the egg on the tray. Image Fig. 7. Image Sample Image Processing: RGB, Grayscale, HOG Image.
processing will be applied using segmentation. This will be
done with a threshold set to eliminate other elements of the a) Extracting Feature using HOG: Histogram of
image except for the embryo. The image will be applied with Gradients computes the gradient image in x and y. These
image binarization technique to yield desired image. A capture changes in patterns , texture and contour, while
fertilized egg with age 4 to 8 days usually has dark spot seen on providing resistance to illumination variations. Then, the
the yolk. This dark spot resembles a web-like pattern of the image window is divided in small spatial regions or cells. Each
veins. On the other hand, unfertilized egg usually is clear inside. cell is consist of gradient or orientations over all the pixels in
When the image is clear, the egg will be classified as the cells. Combining all gradients, forms the orientation
unfertilized. The tray will be automatically transferred to the histogram representation. The orientation histogram divides
unfertilized egg’s area. When the image is seen to have dark the gradient angle range into fixed number of predetermined
areas, the system will evaluate the pattern. When the pattern is bins. The equations used was shown in Eq. 1, 2.
having web veins, the egg is classified as fertilized. The tray
holding the egg will be then transferred to the fertilized egg’s 𝑀𝑎𝑔𝑛𝑖𝑡𝑢𝑑𝑒 = ,𝑥 . + 𝑦 . (1)
area. After every egg analyzed, the system will stop unless the 𝐴𝑛𝑔𝑙𝑒 𝑂𝑟𝑖𝑒𝑛𝑡𝑎𝑡𝑖𝑜𝑛 = 𝑡𝑎𝑛67 (: )
9
(2)
user still has to undergo classification.
D. Image Preprocessing the Acquired Image The gradient magnitudes of the pixels are voted depending
on what orientation it will fall. Shown in Fig. 8 is the data from
The acquired image of the egg will then be processed to
having a RGB Image, Grayscale Image, and HOG Image where
produce a black and white image. That image will then have to
we retrieve the values for HOG Magnitude and Orientation.
undergo thresholding for the detection of the egg’s embryo
development.
1) Image Processing: This block diagram (Fig. 6) shows
the image segmentation and feature extraction process. The
process starts with image acquisition. After which, the image
will undergo pre-processing which includes image
enhancement for easier analyzation. The image will be
subjected to thresholding. The image will go through feature
extraction to get the details from the image. The feature
extracted will serve as training images to accomplish
classification of eggs from fertilized to unfertilized.
Fig. 8. RGB, Grayscale, HOG Image, and HOG Graph.

3
and humidity of the incubator was done every after the
E. Application of Algorithm measuring the poultry’s environment which was recorded in
Table VI. It is observed that the temperature is higher in the
1) Matching Obtained Data with Database Using Support incubator than in poultry area since eggs requires 37oC to 39oC
Vector Machine: In applying the Support Vector Machine, the with a humidity of 55% to 60% for them to grow while broiler
HOG feature will be first obtained from the eggs database as chicken requires lesser heat for them to lay.
well as from the obtained image of the egg.
2) Egg Monitoring: We had 40 egg samples. After
monitoring their environment, we classify its fertility starting
day 4 until day 8. We indicate the pattern obtained by the egg
sample and record the system’s initial decision.
Fig. 9. Template Matching. G. Calibration
These extracted features will represent points in space used 1) Hardware Calibration
for classifying the eggs. The points were mapped to separate
a) Servomotor Calibration: There are two servomotors
categories divided by a clear gap which is made as wide as
used in this system. The first servomotor is used in the rotation
possible. The space will be used as the basis of the Support
of the egg socket and the other is used in the egg sorter flipper.
Vector Machine to predict the classification of an egg. Points
We calibrate the speed of the servomotors in pulse measured
will be mapped and classified depending which side of the gap
in milliseconds (ms) for the safety of the egg samples.
the point will fall.
b) Camera Position Calibration: The egg positioning is
F. Source of Egg Samples a critical factor in the determination of the egg’s fertility using
Our eggs sample will come directly from the hatchery farm candling. The system relies on the structures or patterns that
in San Carlo, Pampanga. We will get a set of 40 fresh laid eggs can be seen inside the egg. The sample image of a fertilized
for classification. sample using top and side view is shown in Fig. 10. To
maximize the view of the camera of the egg structure, the egg
1) Environment Monitoring: The eggs will first be will be place in upright position on the side of the camera.
monitored by their environment on where they were laid and
their incubator. We will measure its temperature (oC) and
humidity (%) from the day it was laid.

TABLE I. POULTRY (10:00 AM) Fig. 10. Fertilized Sample: Top View (right), Side View (left)
o
Day Temperature ( C) Humidity
1 30 46% 2) Software Calibration
2 29 47% a) Calibration of Training Size: To achieve the best
3 31 40% fitting for best prediction of the system, the number of training
4 32 52% size that will fed to the SVM for training must be picked
5 32 43% correctly to avoid underfitting and overfitting. The training
6 31 41% size in Table IX where the misclassification error is lesser
7 30 59% signifies the best training size for our system’s SVM. Training
8 31 60% size of 50 is the most accurate therefore, it is the rank 1.
TABLE II. INCUBATOR (10:00 AM) TABLE III. SVM TRAINING SIZE ACCURACY
Day Temperature (oC) Humidity Misclassification
1 38 53% Training Size Accuracy Rank
Error
2 37 56% 30 0.72 0.28 4
3 38 54%
40 0.75 0.25 2
4 39 57%
50 0.88 0.12 1
5 37 56%
6 38 58% 60 0.73 0.27 3
7 39 54% 70 0.68 0.32 5
8 37 55% 80 0.63 0.37 6

The environment monitoring of the poultry where the eggs b) Calibrating the Support Vector Machine Classifier:
were laid was done every 10:00am from February 16 to To achieve the best fitting for best prediction of the system,
February 23 of 2019 in Mr. Sambile’s poultry farm at Sto. calibration of Support Vector Machine SVM will be
Domingo, Pampanga. The measured temperature and humidity performed. The goal is to arrive at the best possible fitting with
of the poultry area was recorded in Table V. The temperature

4
high accuracy for the training database and test database for
future prediction reference. Table XI shows the actual testing accuracy of the system.
The parameter to be varied in SVM is the cost (C). The The number of samples is 40 eggs, all monitored from day 1 to
highest accuracy was achieved with Cost of C = 1. day 8. The determination of fertility started in Day 4, this is to
prevent affecting the egg’s growth due to human interaction
TABLE IV. SVM COST PARAMETER (C) (Egg is most sensitive from Day 1 to Day 3). The system
Number Number of
accuracy from Day 4 to 8 is increasing. The highest accuracy
Value of was attained in day 8, making it two days earlier than the normal
of Samples
SVM Cost Accuracy Rank day of removing unfertilized egg in incubator. (Removing of
Samples Correctly
(C) unfertilized egg in incubator was normally done in Day 10).
Tested Predicted
10000 50 19 0.38 6 I. Statistics
1000 50 26 0.52 5 Z-test is used to compare the identification of fertility of our
100 50 31 0.62 4 system to past studies. Z-test is normally applied to normal
10 50 37 0.74 3 distribution with sample size of more than 30. This test shows
how significant the differences are. The past study accuracy is
1 50 48 0.96 1
86% with sample size of 50 (43. The present study accuracy is
0.1 50 41 0.82 2 92.5% with samples size of 50.

The value of cost that gives the highest accuracy will be set TABLE VI. STATISTCAL TABLE
and used for the algorithm of Support Vector Machine. The
Number of Correctly
SVM Graph is shown in Fig. 11 where the yellow dots represent Accuracy
Samples Identified Fertility
the unfertilized and the violet dots represents the fertilized egg.
Past Study 50 43 86%
Some errors occurred due to the dirt at the egg’s shell as what
happened on the four yellow dots on the fertilized side. Present Study 40 37 92.5%

>>>> − 𝑃2
𝑃1 >>>>
𝑍 = (5)
A𝑝(1 − 𝑝)( 1 + 1 )
𝑛1 𝑛2
𝑥1 + 𝑥2
𝑝 = (6)
𝑛1 + 𝑛2

𝑥1 𝑥2
>>>> >>>> = (7)
𝑃1 = ; 𝑃2
𝑛1 𝑛2

Fig. 11. Support Vector Machine Graph. Where:


>>>> = sample proportion of present study
𝑷𝟏
H. Testing >>>> = sample proportion of past study
𝑷𝟐
For the testing, we recorded our system’s correctly p = overall sample proportion
identified fertility since day 4 to day 8. The actual fertility n1 = sample size of present study
decision was identified by our Poultry Farm owner and an n2 = sample size of past study
expert in poultry, Mr. Boy Sambile. Our highest recorded x1 = correctly identified fertility of present study
accuracy was on the 8th day where the blood veins are more x2 = correctly identified fertility of past study
visible in fertilized egg samples. Errors occurs when egg
samples possess dirt. Attempting to clean it by washing or Ho: The null hypothesis (H0) for the test is that the
wiping may harm the embryo. proportions are the same.
H1: The alternate hypothesis (H1) is that the proportions
TABLE V. SYSTEM DECISION MATCH COMPARED TO EXPERT are not the same.
Total % α: Use 5% alpha level
% Match
Number Fertility Fertility Mismatch
DAY (to the 37
of Match Mismatch (to the >>>>
𝑃1 = = 0.925
Expert’s)
Samples Expert’s) 40
43
4 40 25 15 62.5% 37.5% >>>> =
𝑃2 = 0.86
50
5 40 22 18 55% 45% 37 + 43
𝑝 = = 0.889
40 + 50
6 40 27 13 67.5% 32.5% 0.925 − 0.86
𝑍 = = 0.975
7 40 31 9 77.5% 22.5%
A0.889(1 − 0.889)( 1 + 1 )
8 40 37 3 92.5% 7.5% 40 50

5
TABLE VII. CONFIDENCE LEVEL OF 95% Pampanga by displaying its decision in a Graphical User
Interface (GUI). Comparing day 4 where only 16 out of 40 was
correctly classified from day 8 where 37 out of 40 was correctly
classified, the researchers found that the best time to determine
Confidence level of 95% falls within a value of alpha/2 of 1.96 the egg fertility is on the 8th day with 92.5% of accuracy.

0.975 < 1.96, therefore accept null hypothesis. The proportions IV. RECOMMENDATION
are the same. Both systems are comparable. This system is able to classify egg fertility by capturing an
image of the egg samples and applying pattern recognition.
J. Graphical User Interface (GUI) However, the system does not make accurate output in cases
wherein an egg has a dirty shell. Some eggshells have dry blood
The Graphical User Interface (GUI) is created using the from the hen or dirt that cannot be removed since it may harm
OpenCV. the embryo. This results to a misclassify of the results made by
the system. For future researchers, it is recommended to be able
to apply image processing accurately despite of the dirt embed
on the shell. Also, a more accurate system that can detect egg
fertility from 4 days after being laid as well as to develop a
system that would be able to monitor the embryo’s health until
it was hatched.
V. REFERENCES

Fig. 12. Graphical User Interface. [1] A.H. Ballado and G. O. Avendano. “A MATLAB -Based System for the
Determination of Duck Egg Fertility from the Formation of Blood Vessels
Using Frangi Filtering Method.” International Electronics Conference
As illustrated in Fig. 12, the system will start when the user and Expo Philippines and IECEP 63rd AGM. November 22-23, 2013.
clicked “START”. The following images shows the output of P.2-3
the system’s fertility classification wherein it shows its [2] L. Liu & M. O. Ngadi (2012) “Detecting Fertility and Early Embryo
classification for an egg with a web-like structure as Development of Chicken Eggs Using Near-Infrared Hyperspectral
“FERTILIZED,” for a clear egg and blood ring egg to be Imaging”. Food Bioprocess Technol (2013) 6:2503–2513
“UNFERTILIZED”. [3] Das, K., & Evans, M. D. (1992a). Detecting fertility of hatching eggs
using machine vision: I. Histogram characterization method.Transactions
III. CONCLUSION of ASAE, 35, 1335–1341
[4] L. Liu and M. Ngadi, “Detecting fertility and early embryo development
Upon performing calibration, testing, and gathering of data, of chicken eggs using near-infrared hyperspectral imaging,” Food and
the researchers were able to develop a system that is able to Bioprocess Technology, 6, 2503–2513, (2013).
identify the fertility of an egg from 4 to 8 days of being laid. To [5] Asadi V, Raoufat MH. Egg weight estimation by machine vision and
ensure the accuracy of the system as well as for the safety of neural network techniques (a case study fresh egg) Int J Nat Eng Sci.
2010;4:1–4
the samples, calibration was done on both hardware and
[6] Boleli IC, Queiroz SA. Effects of incubation temperature and relative
software. During hardware calibration, the researchers vary the humidity on embryonic development in eggs of red-winged Tinamou
camera position where the egg sample will be best placed with (Rhynchotus rufescens). International Journal of Poultry Science 2012;
respect to the conveyor belt as well as the speed, or delay, of [7] Lundy H.A review of the effects of temperature, humidity, turning and
the servomotor in both egg socket and flipper. In order for the gaseous environment in the incubator on the hatchability of the hen's egg.
system to detect the fertility of the sample, it extracts the In: Carter TC, Freeman BM, editors. The fertility and hatchability of the
hen's egg. Edinburgh: Oliver and Boyd; 1969. p.143-176.
features of the egg sample whether it possess a web-like
[8] Z. Zhu, M. Ma, “The Identification of White Fertile Eggs prior to
structure which represents the blood veins, a blood ring, or a Incubation based on Machine Vision and Least Square Vector Machine,”
clear egg. Software calibration was done by using the common African Journal of Agricultural Research, vol. 6, June 2011
values of SVM cost to be applied to the HOG patterns gathered [9] Grace Tsai. “Histogram of Oriented Gradients”. University of Michigan.
and verifying fertility results through our expert. Testing was (2010)
also done in a controlled and uncontrolled environment where [10] M. Soltani, M. Omid, R. Alimardani, “Egg Volume Prediction using
Machine Vision Technique based on Pappus Theorem and Artificial
the researchers found that temperature and humidity play an
[11] “Thomas Robins, Inventor, 89, Dies. Developer of Heavy-Duty
important role for the health of the embryo inside the egg; hence Conveyor Belt Had Headed Hewitt-Robins Company". New York Times.
measuring those parameters in both controlled and uncontrolled November 5, 1957. Archived from the original on December 25, 2013.
environment not only helps the embryo but also securing the Retrieved 2013-12-18.
accuracy of the system from day 4 to day 8 of the egg sample. [12] Pant A, Arora A, Kumar S, Arora RP. “Sophisticated Image Encryption
The system was able to determine the fertility of 40 egg Using OpenCV,” International Journal of Advances Research in Computer
Science and Software Engineering, 2012
samples from Mr. Boy Sambile’s poultry farm in Sto. Domingo,

Potrebbero piacerti anche