Identification and Classification of Poultry Eggs with IoT Camera
Identification and Classification of Poultry Eggs with IoT Camera
2019
Kyle Thomas
Southern Methodist University, [email protected]
Daniel W. Engels
Southern Methodist University, [email protected]
Part of the Agricultural Economics Commons, and the Artificial Intelligence and Robotics Commons
Recommended Citation
Lubich, Jeremy; Thomas, Kyle; and Engels, Daniel W. (2019) "Identification and Classification of Poultry
Eggs: A Case Study Utilizing Computer Vision and Machine Learning," SMU Data Science Review: Vol. 2:
No. 1, Article 20.
Available at: https://scholar.smu.edu/datasciencereview/vol2/iss1/20
This Article is brought to you for free and open access by SMU Scholar. It has been accepted for inclusion in SMU
Data Science Review by an authorized administrator of SMU Scholar. For more information, please visit
http://digitalrepository.smu.edu.
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
1 Introduction
The number of backyard egg production farmers are increasing as the demand
for organic, locally produced eggs becomes more popular. Many of these farmers
lack training and guidance from the commercial egg production industry to
understand the health and reasons for variability of egg production in their
flocks. Age, breed, weather, parasites, feed, stress, housing and other factors
play a role in egg production volume and quality. Backyard farmers who treat
their flocks more as pets than livestock introduce many variables and conditions
which are not tightly controlled and monitored like typical commercial farms.
Novice farmers may not have the knowledge and laboratory access to monitor
their flock, however they do have their own set of metrics which they can collect
such as age, breed and the number of eggs they are observing. The automated
collection of weather and number of eggs may provide the necessary data to
help make a measurement of whether a given flock is performing above or below
2 Related Work
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 2
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
3 Data
A variety of original data sources were produced which measure and describe
the flock of 22 chickens on a hobby farm in Afton, MN.
egg and chicken categories and subcategories (as described in the characteris-
tics sections above), manually drawing a rectangular bounding box around each
object in the images and assigning a classification to the object. After images
have been marked up with these labels, the site labelbox.com produced a json
file containing all the X & Y locations for each labeled object and image.
Fig. 1. This figure shows how an input image is processed by the DeepLens Camera
(the “Device”) and how the output image can be stored on the device or sent back to
the cloud via a project steam. Image created by AWS. [24].
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 4
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 6
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
is located), sample pixels within each estimated bounding box, and apply a clas-
sifier to that bounding box [10]. This approach results in high accuracy, but is
typically quite computationally expensive and slow [10]. Our modeling approach
utilizes a Single Shot multibox Detector (SSD). SSD which combines image lo-
calization and classification in a single step which greatly reduces computational
overhead [18]. An SSD accomplishes by making multiple “default” bounding
boxes, generating scores for each box, and finally adjusting the boxes to improve
box placement all in one step [10]. SSD is further discussed in the Methods and
Materials section.
Evaluation of object detection algorithms presents an interesting problem.
There is more to consider than accuracy or recall for the classifier. Since these
algorithms are also trying to specifically locate where in the image a object
resides attention must be paid to the precision of bounding box placement. The
method that we utilize in this paper for evaluation of bounding box placements is
the average precision (AP). AP can be viewed as the summary of the precision
and recall curve for the classifications in the image [13]. Furthermore, AP is
defined as the “mean precision at a set of eleven equal spaced recall levels”
between 0 and 1 [13]. The mean average precision (mAP) is simply the average
AP across all classes.
In addition to AP the concept of intersection over union (IOU) is critical
the evaluation of object detection algorithms. IOT is the amount of intersected
area, or overlap, between the truth bounding boxes and predicted bounding
boxes divided by the the union of the area between the two bounding boxes
[13]. The IOU for any detection must be greater than 50 percent before being
considered correct.
live and therefore appear in a wide variety of angles and vantage points. The
background of our training data is relatively static, so the ability to deal with
imbalances in background context is not directly applicable to our application.
The pre-trained model that we utilize is a pre-trained ResNet-50 model [5].
This model consists of 50 layers, was trained on 1,280,000 images, and could
detect 1,000 different classes [17]. This model expects inputs in the shape of (N
x 3 x H x W) [15]. In this equation N is the batch size, H is the height of the
image, W is the width of the image, and three represents 3-channel RGB [15].
The equation is expecting H and W to be at least 224 [15]. These assumptions
are treated as hyper-parameters in the AWS model. There are many other hyper
parameters than can be used to fine tune the model.
Egg production of a chicken has many variables which affect the output of a
laying hen. Egg production does not require a rooster to fertilize the hens to
produce an egg. A hen starts laying when she is about 6 months old. Chickens
need about 25 percent of their diet to be protein. Increased protein, greater than
25 percent, in the diet may accelerate the time when the first egg is laid down to
about 4 months, though there is debate on the ethics of forcing egg production
this early [22]. During a hens life she lays only the number of eggs she was born
with, and once she is out of eggs she will continue to live out her days but does
not produce additional eggs. Typically, a hen produces only 500-600 eggs total
and these will be laid over the course of 2 years and taper off.
Egg production is directly tied to the amount of daylight a chicken experi-
ences. Typically, it takes 26 hours of daylight for a chicken to go through the
process of creating an egg [23]. Artificial lighting is commonly used to keep the
egg production cycle operating continuously in egg factories. Natural lighting for
free range chickens varies the speed of the production process as shorter days,
such as winter in north American, slow down the production of those hens.
Other factors such as weather, stress, molting and illness can reduce egg
productions. Changes in weather, like cloudy grey skies and rain, can reduce the
sunlight which stimulates a flock to lay and can take a couple days for the flock
to get back to normal laying volumes. Twice a year chickens molt, which means
they lose their feathers so that they can grow new ones [22]. During molting
their bodies need additional protein to regrow feathers. Stress can be caused by
changes in their environment, predators or even inter-flock fighting. Many times
the roosters (adult male chickens) actively manage the pecking order within the
flock and hens who are lower in the hierarchy get attacked. This can cause stress
and injuries which reduce the energy and protein available to the hen to use for
egg production. Sexual aggressiveness and fertilization of eggs slows down the
production rate of hens.
Hens share the responsibility of incubating eggs and when a sufficient clutch
of eggs has been laid a hormone triggers them to go broody. Broody hens have a
strong instinct to stay on a nest of eggs until they hatch, which takes about 21
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 8
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
days [22]. During that time their metabolism slows, they stop laying eggs and
dont leave the nest except for about once a day to quickly eat, drink and relieve
themselves. A broody hen generally loses much of their body weight and after
they leave the broody cycle it takes a few weeks for their body to get back into
the normal egg production rhythm.
Various varieties of chickens have been selectively bred to optimize various
laying qualities of chickens. Some breeds are optimized for cold or hot weather,
laying vs meat production, white eggs vs colored eggs, large vs small body size
[21]. Finding the right type of breed for your egg production needs can be dif-
ficult with so many choices available. The American Poultry Association is the
foremost organization which defines and recognizes over 113 distinct breeds.
These breeds come from many parts of the world and are organized into 12
classes. Within classes many colors, shapes and sizes are available and addition-
ally many hybrid types of chickens exist by selectively mixing these standard
breeds.
Egg shells are created to protect and store the egg contents. The shells are
mainly calcium carbonate and are naturally white colored for all breeds during
the first 20 hours of the egg production process. Commercial producers mainly
choose breeds which keep the eggs white colored. Naturally though some breeds
create different pigments which turn the shells pink, brown, blue or green. The
brown pigment is called protoporphyrin and the blue pigment is called biliverdin
[19][20]. These two pigments are chemically similar with biliverdin being derived
from protopophyrin through the addition of iron to that compound. When a
chicken produces biliverdin it coats the outside of the shell while the inside of the
shell remains white. When a chicken produces biliverdin it penetrates the shell
and the inside and outside have the blue color. Certain breeds can be produce
both pigments and produces a range of blended colors in the green spectrum,
and the outside of the shells are green while the inside may be blue.
Accurate tracking of a flocks egg production can help a farmer understand
if there are trends or anomalies in their egg production which should be investi-
gated. Currently there are few methods available to accurate track egg produc-
tion by hen since they are mixed together within a flock and monitoring them
24x7 is impossible.
separate models we can also compare how different models preform at similar
tasks. For example, one of our hypothesis was that the algorithms that were
responsible for detecting chickens or eggs alone would preform better than the
model that detects both simultaneously. What follows is a analysis of each of the
aforementioned sub-problems. For each sub-problem two models were created.
One model that utilized transfer learning, and one trained from scratch using the
same base ResNet50 architecture but with the weights of the neurons randomly
assigned.
The data set that we utilized consisted of 363 different images. In total there
were 12 unique classes across the images. There were eight different classes that
represented chicken breeds, and four different classes that represented egg-shell
color. For three of the models these classes were collapsed into smaller subgroups.
There was an egg sub-group which contained only images of eggs and consisted
of one class. There was also a hen only sub-group which also consisted of a single
class. Finally, there was a hen and egg sub-group which contained two classes
rather than 12.
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 10
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
same height. The other fifty images were pictures of chicken eggs gathered from
the internet. These images contained eggs in different connotations. For example
there were images of chicken eggs in peoples hands, or in an egg carton. Fur-
thermore, the eggs contained images at different camera angles. The idea was
that providing the algorithm labeled chicken eggs in different connotations would
result in a more accurate model.
Once the training data had been created, and the base models were selected
we set the hyperparameters that could be used in this object detection algorithm.
There are in fact a dizzying amount of combinations that can be used when
training these models as many of the training hyperparameters are continuous
inputs. Traditionally, an exhaustive search of selected hyperparameters would
have been conducted until an optimal solution was empirically found. However,
we utilized AWS Hyperparameter Tuning feature. This approach treats the se-
lection of hyperparameters as supervised machine learning regression problem
[11]. This allows the user to input possible test ranges for hyperparameters and
the tuner will at first make a few guesses to see how the model preforms [11].
From that point onward the tuning process uses regression to choose the next
hyperparameters to test, and proceed in an iterative fashion to maximize the
target valuation metric [11]. The validation metric that we decided to use was
mean average precision (mAP).
The model was run 10 different times during the hyperparameter search
process. After completing these iterations the best configuration was reported.
The hyperparameters and mAP for each approach are shown below:
The tuning jobs results in different Learning rates and mini-batch sizes. The
optimizer found to be optimal for both models was adadelta. The major differ-
ence between the two models is the mAP. Using the pre-trained model allowed
us to achieve a much higher mAP using the same training data.
The hen detection model followed the same strategy of the egg detection model.
Just like the egg detection model, a ResNet-50 CNN was used as the base net-
work. SSD was used as the object detection and classification algorithm. The
training data used to create this model was a subset of the master training data.
We search the JSON label data for images that only had hens in them (in other
words, none of the training or test data contained an image of an egg). This re-
sulted in a training set of data. Once the data set was sub-selected, and the base
network was set up, we utilized a hyperparamter search to find the best model
possible utilizing both a pre-trained model and a randomize network. After 50
iterations the best performing models were compared. The results are shown in
the table below:
Once again the two different methods resulted in different learning rates
and mini-batch size. The best optimizer remains to be adadelta. There is still
a significant improvement between the pre-trained network and the raw net-
work. Interestingly, there is also a moderate discrepancy between this single
class model, and the eggs only single class model for the randomized network
(eggs only mAP of 0.05 compared to hens only mAP of 0.279). This difference
can likely be explained by the fact that there are more images in the chicken
only data set. Alternatively, it could be due to the fact that the eggs are a much
smaller object to detect compared to the chickens.
So far, we have shown that we can build a very accurate model that detects
both chickens and eggs separately. However, we now want to build on top of this
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 12
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
model and see if there is a decrease in accuracy when detecting both eggs and
chickens simultaneously. The training data for this model consisted of all the
images of chickens and eggs from four nesting boxes. In total, there were 290
images used for training and 72 images used as validation. The images contained
labeled training data of eggs alone, chickens alone, and chicken and eggs in the
same image.
The training process for this model is the same as the previous two models. A
base ResNet-50 model utilizing transfer learning and a hyperparameter search is
used to search for a model with the lowest mAP score. Likewise, a raw network
is trained using the same data for comparison.The final models had the following
hyperparamters:
This model follows the same pattern of the previous two sub-problems. Learn-
ing rates and mini-batch size differ between the two models, yet the optimizer
remains the same. There is not as much difference between the raw network
model, and the raw network model of the hens only classifier. In fact the per-
formance decreased between the raw network models despite there being more
training data in the two class problem. This could be due to the random nature
of the hyper-parameter tuning, or it could also be the fact that the raw network
simply does not have enough training data to reliably find eggs in the images.
This is an interesting hypothesis because the chickens are much more complex
in their shape, color, and relative size when compared to the eggs making them
easier for the network to identify. Therefor, the inclusion of the eggs in this model
could explain the decrease in the mAP score as there is simply not enough data
available for the network to reliably detect eggs.
While the mAP of the pre-trained network is still impressive considering the
paltry training data set, it is significantly less accurate than both the egg only
and chicken only models. This is likely due to the fact that this model had to
manage multiple classes.
We have seen that the object detection algorithm can reliably distinguish be-
tween chickens and eggs. The last thing that we wanted to test for the object
detection model was its ability to detect individual breeds of chickens and eggs.
To accomplish this task, we had to alter the JSON meta-data. We kept the same
image locations, but we had to update the class information to reflect individual
chicken breeds and eggs. Chickens are much easier to label. In total there were
eight different breeds of chicken utilizing the chicken coop. However, labeling
eggs proved to be more difficult. We could not readily distinguish between the
eggs by breed, so these were grouped by color. In total, there were four different
egg colors identified in the images.
Once the training data had been updated to reflect these new class labels, we
essentially re-ran the chicken and eggs model in another hyperparameter search.
We used the same base network and utilized transfer learning. Our hypothesis
was that the mAP of this model would decrease significantly as there were now
12 different classes for the algorithm to learn. The best model learned after
the hyperparameter search had a mAP of 0.8255 which represents only a small
decrease in accuracy over the chicken and egg detection model. The learned
model had the following hyperparameters:
Once again the both of the models find different optimal learning rates and
mini-batch sizes, and settle on the same optimizer. There is still a large difference
between the pre-trained model and the raw model. Interestingly, this model with
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 14
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
12 classes in it did not perform much worse than the two class model. There was
a 7.19 percent decrease between the 2 class chicken and egg model and the 12
class pre-trained models. There was a slight increase in accuracy between two raw
networks (0.3 percent increase). We found these results to be very interesting.
Based on the large drop in mAP when moving from one class to two classes we
expected significantly lower mAPs for the 12 class models.
An example output of the 12 class model is shown below. Note that is classifies
hen breed and egg color, and that the bounding boxes have accurately localized
the objects.
Fig. 2. This image shows the output of the modeling process. A before and after image
is shown for ease of comparison.
In order to effectively understand the egg production of hens the number of eggs,
by egg type, must be calculated and tracked between frames. Fundamentally this
can be broken into two sub-problems. Counting eggs, and tracking them between
the frames. Our approach to solving these problems involves a more traditional
approach using custom made algorithms.
Counting the eggs is relatively straight forward. Each processed image from
the 12 class object detection model comes with a confidence score of each de-
tection, a predicted class label (integer representation), and a bounding box
location. We can easily utilize this data to count the eggs by class membership.
However, the output of object detection model is quite noisy, in that there are
many predictions that are of low confidence that contain miss-classifications.
We created a simple algorithm that filters out predictions based on a confidence
level threshold, and returns a sub-set of predictions. We can then use this fil-
tered sub-set to count the number of classes that remain. The challenge remains
in finding a cutoff threshold that reliably filters out misclassifications without
also discarding valid predictions. Interestingly, even through the mAP values
for the 12 class object detection model is relatively high, there are individual
predictions of eggs in some of the test data that have extremely low confidence
values associated with them. This means that in order to properly detect all of
the eggs the threshold calculation must be finely controlled. An example of how
small differences in the cutoff threshold can change results is shown in Figure
3. Currently, we arrive at a cutoff value through empirical testing, although a
more rigorous approach would be warranted if this were to be deployed in a
production environment. In general, we find that low confidence (high teens to
low twenties) tend to find all of the eggs without missing eggs in the nest. This
process was repeated for chickens.
Low threshold values increases the odds of false positives. We are of the
opinion that having false negatives (not detecting an egg) would be preferable
as the mistake wold be easier to catch in subsequent input data. For example,
if an egg was not detected and a new hen laid an egg there is a chance that
the missed egg will be moved. This movement could produce a more favorable
image and result in detection. Then, the counting is only off slightly by a hen,
rather than having the potential for misidentified eggs to go missing in the next
image. When deployed onto a video stream there may be many inferences taken
on the same/similar images due to the streaming nature of the camera. This
allows for multiple comparisons of the same or similar input images to correct
for any missed eggs.
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 16
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
Fig. 3. This image shows how the cutoff threshold of prediction confidence impacts
bounding boxes and the detection of eggs. On the top, the cutoff threshold was too
low (0.05). The image in the middle correctly identifies all of the eggs and their classes
(threshold of 0.17). The bottom image shows that an egg has been missed if the thresh-
old level changes only slightly (threshold of 0.18). This demonstrates the need to de-
velop a metric to determine optimal threshold so that predictions can be appropriately
used to count and track individual eggs.
Once we could reliably detect and identify chicken eggs and breeds we wanted
to track eggs between images. Ideally, this would allow us to determine when a
new egg was laid, and which breed of hen laid it. Multiple attempts were tried,
but most ended in failure. At first, we wanted to test to see if we could track eggs
in the image based on the average color of the egg shell. This was done by tacking
identified egg labels (using class information), and sampling pixels within their
bounding boxes. Then, we could take the sampled pixels and conduct simple
t-tests to determine if the average RGB color between two different images was
the same. In theory, this could allow us to track individual eggs between images
as there should be minor differences in egg shell color that would impact the
overall color values. Our process involved sampling 1000 pixels with replacement
from the two different images. We tested first, between eggs that we knew were
the same. We ran into two main problems with this simple approach. First, there
were differences in lighting between images which impacted the sampled colors.
In addition, the number of samples resulted in a very powerful test and a very
minor difference in egg shell colors due to the sampling process was treated as
a false negative. We believe that this problem could be solved if differences in
lighting were better controlled.
Another method that we examined was using the class labels and information
contained in the bounding box to track egg location using euclidean distance.
The idea here is that we could use class membership to partition the eggs into
groups. Then within each group we can track the location between images by
finding the closet egg of the same color based on their last known location. The
current version of the algorithm iterates through all of the detected eggs at or
above the threshold value and maps it to the closet match in the next image.
However, due to the data structure the same egg can be used more than once.
This algorithm needs to be improved so that eggs can only be used in 1 mapping
and account for ties in distance.
Once the object detection and classification models have been trained they are
deployed to the field using an Amazon Deep Lens Camera. Once deployed, our
team utilizes Kinesis Video Streams which is another technology provided by
Amazon. Amazon Kinesis Video Streams allows the team to use the previously
trained models to detect the presence of chickens. This serves as a triggering
event to record a predetermined amount of video (typically between 30 and
60 seconds). This video capture is triggered each time a chicken is detected.
Therefore, if a chicken enters the nest to lay an egg then the there is video of
the chicken the entire time until a chicken is no longer detected (empty nest or
eggs only in the image). We can then use the last image in the video to run
more analysis on egg production with the knowledge that a chicken has been
in the nest recently. We can then count the eggs in the nest and compare that
information to the state before the chicken entered the nest.
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 18
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
Utilization transfer learning has yielded great results for this project. With only
363 images we were able to create object detection models with mAP values be-
tween 0.8255 and 0.99. Without utilizing transfer learning, while using the same
training data, the object detection models had mAP values between 0.0547 and
0.279. Clearly, using transfer learning allowed our analysis to proceed signifi-
cantly faster than if we had built a model from scratch. We likely would have
had to have hundreds, or even thousands of more training images to achieve
similar results.
While all of the models that were based on transfer learning had good mAP
values, we found that the prediction output had a wide variety of confidence
values for individual egg detections. Some of the predictions that correctly iden-
tified an egg class contained very low confidence values. This presented us with
an interested problem of picking a cutoff confidence threshold to partition the
predictions into practical working data set that we could feed to tracking algo-
rithms. We have no definitive answer on what cutoff threshold should be used
and we recommend that this problem be further studied so that a valid metric
can be created and used to reliably select a cutoff threshold.
Once the final models were created, we investigated methods to track indi-
vidual eggs between images. We utilize the class membership and bounding box
information from the models to track egg location. We investigated two primary
methods. First, we broke apart the eggs in each picture based on its predicted
class membership. We then iterated through each egg by group membership and
found the closest egg based on label and euclidean distance based on the X and Y
coordinates of the bounding box. Another method that we examined was track-
ing eggs based on egg shell color. For each egg we sampled the pixel data within
the bounding box to get RGB values for each egg. Then we conducted simple
t-tests between each egg to determine if the average color of the egg was the
same between the two images. Unfortunately, this method did not differentiate
between eggs. We believe that this is due to color differences between the images
based on lighting. We believe that this problem could be controlled for by fixing
lighting levels in the coop to minimize color distortions. Thus far we do not have
a reliable method to track individual eggs between images. The ability to track
individual objects, in our example these objects happen to be eggs, between
two images across time represents an interesting research problem, but one that
proved to be beyond the scope of this work.
Once tracking of individual eggs is possible, and can be mapped back to a
single chicken, analysis could be conducted on that chickens productivity auto-
matically. These analytics could then be compared to statistical base lines to
evaluate chickens as a whole, and the productivity of the flock as a whole. If
there is insufficient data the productivity of differing breeds could be tracked
automatically once egg tracking is complete. While this is not as a fine analysis
as individual chickens, it still can provide farmers with detailed insights into
their flocks.
8 Ethics
Acquiring, processing and storing the video and labels of poultry flock production
carries ethical considerations which must be addressed from several different
perspectives. If released as a product, the farmers who provide video access to
their flocks provide a certain amount of data currency which can be tapped into
and must be protected and handled in an ethical manner. As researchers we hold
a responsibility to ensure there is transparency and security in how we handle
the data as leaks or mishandling of this data could have damaging consequences
to farmers.
There is considerable debate about the ethics of animal food production
in general, so farmers need to protect the images of their farm to maintain
an image of wholesomeness. One of the worst looking places in a farm may
be the chicken coop; conditions where a video camera is monitoring a flock
may not be representative of the overall conditions that the chickens experience.
This biased sample of living conditions may be used against a farmer; thus, our
responsibility is to protect the images acquired from being made available to the
public. Consent to collect and keep acquired video data private is paramount.
The primary goal for most poultry farmers is to maximize produce eggs.
Data on free range poultry flock production is typically only possible to collect
on an aggregate basis, that is, we may know that 25-70 percent of a flock is
producing, but we dont typically know which birds are producing and which are
not. As farmers have better technology to measure the production rates of their
flock as well as individual birds they may have better data to perhaps change
conditions but may also be led to cull birds more selectively/aggressively if data
shows certain birds are not producing as much as others.
What happens if our data suggest a chicken is an under-performer? If a
chicken is truly under-performing, a farmer may decide to cull that chicken.
What if however, it was simply a temporary period of under-performance that
would naturally resolve, such as molting or illness? If we led the farmer to cull
that bird early, he may lose out on the benefit of having that bird produce at a
later in the future. We as researchers have an ethical responsibility of ensuring
our data is accurate and is presented in a manner which does not incorrectly
label certain birds as under-performing unless sufficient data warrants that label.
We must ask ourselves what our obligation is if we observe a poorly cared
for flock. What if we see signs of cruelty, abuse, neglect and/or disease? Are we
obliged to report on these conditions even if it may breach the confidentiality
agreements we have with the farmer? The American Veterinary Medical Asso-
ciations (AVMA) website lists a state by state list of requirements for reporting
animal abuse. Some states have a mandatory policy; however these laws typically
apply only to veterinarians, and not researchers such as ourselves. Nevertheless,
if this system is further developed we may have to determine if and when we
report animal abuse even if it is not a legal requirement.
Chicken breeding and poultry production businesses must guard their trade
secrets and production rates to stay competitive. We as researchers bear a sig-
nificant responsibility to keep any acquired data protected and safe. Farmers
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 20
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
owner the data about their flocks and we must get express consent on any use
and anonymization of their data.
As we collect data from multiple flocks we have the ability to do cross flock
analysis and spot differences between how flock conditions materially correspond
to production rates. For example, if we spot certain types of feed correlate to
better production outcomes we may be able to bring these product recommenda-
tions forward to the poultry community. Consider the scenario where we get an
industry sponsor which produces a certain brand of feed. Would we be ethically
obligated to disclose that sponsor? Would we be able to ethically recommend
their feed, especially if we saw it was not the best option? These are among a
myriad of ethical considerations that arise when we start looking at inter-flock
analysis and sponsors.
9 Future Work
Two major sections of future work involves long term time-series analysis and
inter-flock analysis.
Our research was conducted only on a 6-week sample of data during the
winter of 2018-19 on a flock of 22 chickens which were of mixed ages. In the
future, wed like to start collecting data on individual egg production starting
from their first eggs until their last. Over time we can build a lifetime profile
of a chicken, so we can better understand how seasonality and other factors
tie into the production rates of individual birds. During a birds lifetime they
may go through molting, illness or other factors which cause temporary periods
of decreased production. It is unknown if there are factors or even periods of
increased production. A longer period of data collection may take up to 3-5
years as many chickens keep producing up until that age (they may live for more
than 10 years, but egg production ceases before then).
Another future work would look at the correlation between weather and
production. It is known that sunlight is directly tied to production rates, however
less is known about how temperature, humidity and stress factors into production
rates of free-range flocks. Can farmers mitigate against some of these conditions
and how effective are would these mitigation strategies?
One type of future work involves inter-flock analysis. For example, by com-
paring peer flocks we can determine if a flock is under or out performing other
flocks. Can we show that different feeds can impact the production of similar
flocks, holding all other factors constant? The same type of analysis could be
performed for species, coop-type, amount of free-range time, amount of medical
treatment, type of medications and/or immunizations, and a myriad of other
conditions.
There are some technical challenges that we would like to work through to aid
in this analysis. We have observed that there are color imbalances in the images
caused by differences in the time of day, climatic conditions, and the number
of chickens in the coop. Additional accuracy may be possible if the lighting
conditions in the coop were controlled, or through additional pre-processing of
the images. The mAP values of the models would very likely be improved with
additional training images. Building upon the foundation of an accurate system
for the measurement of poultry production by bird really unlocks potential for
future work that is simply impossible to do through conventional method and
we are excited to see where the future of this work goes.
10 Conclusions
References
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 22
Lubich et al.: Identification and Classification of Poultry Eggs with IoT Camera
https://scholar.smu.edu/datasciencereview/vol2/iss1/20 24