Coder Social home page Coder Social logo

bastinrobin / fruitsrecognitionapp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from deepquestai/fruitsrecognitionapp

0.0 1.0 0.0 172.52 MB

A Flask Web App for recognizing fruits, using DeepStack Custom Model APIs

HTML 61.27% CSS 16.50% JavaScript 2.36% Python 19.87%

fruitsrecognitionapp's Introduction

FruitsRecognitionApp


A Flask Web App for recognizing fruits, using DeepStack Custom Model APIs
DeepStackDemoImg

Classes of Fruits detected


There are 7 classes of food detected by the FruitsRecognitionApp.

Deep learning architecture


The deep learing model used in this FruitsRecognitionApp was built on a deep neural network architecture know as ResNet(Residual Neural Networks). Residual neural networks are a special kind of deep neural network architecture that makes use of residual units. Residual unit is made by joining two or three convolution neural networks together and adding the input of the previous convolutional network to the out the next convolutional network. These residual units help to solve the most difficult problems with deep neural networks know as varnishing gradients. Residual neural networks also have there challenges like diminishing feature reuse, but they have to prove to work really well when building a deep learning model. Hence they are used in this project

How FruitsRecognitionApp works


This web app is built on bootstrap, flask and jinja. The web app take the image to be classified send it to the custom model endpoint on DeepStack AI server an resturn a JSON. This JSON value contains the the true label for the image, and the model confidence score which is then displayed by the web app.
The model used used for this predictions was built with pytorch as exported to onnx with the code bellow:

load_saved_model = torch.load('<model_name>.pt')
dummy_input = torch.FloatTensor(1,3,<int:img_width>,<int:img_height>)
dummy_input = dummy_input.to(device)
torch.onnx.export(load_saved_model, dummy_input, '<onnx_name>.onnx')

The model was deployed to deepstack using the code below:

#config.json file
{"sys-version": "1.0",
    "framework":"ONNX",
    "mean":0.5,
    "std":255,
    "width":224,
    "height":224,
    "map": {
        "0" : "Apple",
        "2" : "Mango",
        "3" : "Orange",
        "1" : "Banana",
        "4" : "Strawberry",
        "5" : "Tomato",
        "6" : "Watermelon"
    }}
    
#deeploying_to_deepstack.py
import requests
from io import  open

model = open("FruitsDetect.onnx","rb").read()
config = open("config.json","rb").read()

response = requests.post("http://localhost:80/v1/vision/addmodel",
            files={"model":model,"config":config},data={"name":"FruitsDetect"}).json()

Images of an uploaded image and the displayed results uploaded fruit image return class results

Frameworks used


Pytorch:

PyTorch is software, specifically a machine learning library for the programming language Python, based on the Torch library, used for applications such as deep learning and natural language processing. It is primarily developed by Facebook's artificial-intelligence research group, and Uber's Pyro probabilistic programming language software is built on it. It is free and open-source software released under one of the BSD licenses.
https://pytorch.org/

TorchFusion:

A modern deep learning framework built on pytorch to accelerate research and development of AI systems.

pip3 install torchfusion_utils

Numpy:

NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.

pip3 install numpy

Mathplotlib:

Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits like Tkinter, wxPython, Qt, or GTK+.

pip3 install matplotlib

Flask

Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions.

pip3 install flask

Bootstrap

Bootstrap is an open source toolkit for developing with HTML, CSS, and JS. Quickly prototype your ideas or build your entire app with our Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful plugins built on jQuery.
bootstrap

Installing DeepStack


Windows
Linux

fruitsrecognitionapp's People

Contributors

abimbolaoo avatar olafenwamoses avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.