Inspiration

Often, we find ourselves wasting perfectly good food simply because we cannot properly tell if it has gone bad. Our dream was to alleviate this issue by building a program that could systematically distinguish fresh versus rotten produce by image.

What it does

The program is a sequential model built in Pytorch. The program allows the user to train a model on positive (rotten) and negative (fresh) images, test the model trained, as well as run a generated model against an image to determine its freshness.

How I built it

The model was created by taking the CNN architecture from VGG19 and adding a classifier that that determined freshness. Images were scaled properly and fed into the CNN. The output of the CNN was flattened and fed into the classifier which, through a series of dense layers and activation functions, produced a value between 0 and 1 marking the likelihood of an image being rotten.

Challenges I ran into

Time was a persistent issue. We obviously could not build the model entirely from scratch, so we had to come up with a way to use previously trained models in some way. The solution we came up with was to frankenstein the VGG19 CNN into our model in order to avoid having to train feature extraction. Additionally, we often ran into dimensionality problems with tensors which had to be debugged by setting a constant image size.

Accomplishments that I'm proud of

Surprisingly, the model showed around 87% accuracy with the testing set which was quite impressive. Mostly, we are happy to have gotten our feet wet with working with neural nets.

What I learned

We learned how to design and test models as well as fine tune our models to improve their accuracy.

What's next for Fresh Food

Our project could be improved by researching more robust models to raise our accuracy score. In addition, we could also improve our testing set to more rigorously test our model as well as incorporating the model into an app so that users can evaluate food freshness on the spot.

Share this project:

Updates