top of page
Search

Eat The Right Meat!

When it comes to the consumption of red meat, a lot of questions pops up in our minds. Does the consumption of red meat increase the risk of heart attack? Is it good for skin? Despite all these questions the consumption of red meat among human beings has never been reduced and the one and only reason for that is the obvious taste of the meat.

But after the horse meat scandal in Europe and dog meat scandal in Vijayawada, India, we all have this doubt whether we are eating the right meat.


For decades now the problem of red neat substitution is being in existence. Red meat substitution is done in butcher shops when a particular meat(like mutton,beef,etc.) is expensive in a particular season, then they get substituted with less expensive meat sometimes even meat of animals that we usually don’t intake.




We have had an oblivious ears to the nasty truth of the meat scandal all these years hoping that we are eating the right meat we have ordered for.

Well, we no longer have to stay that way!!! What if I tell you that you can come to know whether you are eating the right meat with the help of your mobile. All that you would have to do would be to take a picture of the meat given to you from the butcher shop in your mobile camera via an app and you would come to know whether you are getting the right meat!!

Yes, we are on our way to achieve this dream into a mobile application. As of now I have the backend working ready that I would be sharing with you.

Without much ado let’s jump into coding part!! I have deployed a supervised machine learning model to detect meat adulteration. We input the model with pictures of both adulterated and unadulterated meat images of different meat categories. The model gets trained with the labeled input. Hence, when we take a picture of the meat and input into the model the model classifies it into adulterated or unadulterated meat.


Tensorflow is used to categorize the input image as adulterated or unadulterated.


All the images which are to be trained and tested should be in jpeg/jpg format with 100*100 dimensions which is the maximum size preset in the code. The images which adhere to those conditions are converted to 8 bit grey scale images (black and white) which is later layered and categorized.


In the training images folder the images should be named as, ad.1.jpg, ad.2.jpg... similarly the unadulterated images should be named as, unad.1.jpg, unad.2.jpg... as the class_names are set to be 'ad' and 'unad'.

We set the data set directory path to the respective train and test folders containing the images.



We check the size of the data set using '.shape' attribute and the naming convention is checked by printing its label. Here 0's represent the adulterated meat images and 1's represent the unadulterated meat images.


The same procedure is followed for the training data set.



The test and train images are divided into 255 layers of shades.


The saved model is compiled for training, testing and the accuracy metrics of the categorization model is determined.


We train the model with 100 epochs (number of passes of the entire training dataset the machine learning program has completed) for better accuracy.

We can infer that the accuracy increases gradually from epoch to epoch and in the reaches to 1.0(100%). We take the average of all epochs' accuracy and compute the model's accuracy.


Once all the epochs are completed, we find the accuracy of the model to be 82% which is a descent score for a Machine Learning, Image Processing model.



As we trained the model now we test the model for the images in the test dataset folder where the images are unlabelled, we use the model to predict their label and display.

On printing predictions matrix, we can see SGD - optimizers value and categorical cross entropy value.


Hurrayy!! You have got your own meat adulteration detector model. Stay tuned for further updates on how to develop the front-end of the model and deploy it as a mobile application.

You can find the entire source code and dataset in my github repository.

Please star the repository if you like it!!

3 views0 comments

Recent Posts

See All

Comments


bottom of page