GithubHelp home page GithubHelp logo

cwarcup / wtf_is_this Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 422 KB

Use Tensorflowjs to determine if an image contains a banana.

Home Page: https://is-it-a-banana.vercel.app/

JavaScript 7.11% HTML 12.86% TypeScript 79.41% CSS 0.63%
machine-learning react tailwind tensorflowjs typescript javascript tensorflow

wtf_is_this's Introduction

Is this a banana? ๐ŸŒ

No. Maybe? I don't know. Use this app to find out.

Use the MobileNet model to confirm your suspicions about bananas ๐ŸŒ๐Ÿค”

Getting Started

Visit the live demo here on mobile or desktop and upload an image. After a few seconds, you'll get a prediction.

Feel free to test it out with these images: Banana, Hamburger, Apple

Demo

banana is found demo no banana demo

Built With

TypeScript React TensorFlow.js Vercel Tailwind CSS

Motivation

I wanted to learn more about machine learning and how to use TensorFlow.js. I explored the TensorFlow.js website and found a pre-trained image classification model called MobileNet. I used this model to classify images of bananas and other objects.

Challenges

Image Upload and Tensor

I first had to learn how to use the URL.createObjectURL method to create a URL for the image file. After reading the TensorFlow docs, I learned that the tf.browser.fromPixels method can be used to convert an image to a tensor. The fromPixels method takes in either an ImageData, HTMLImageElement, HTMLCanvasElement, or HTMLVideoElement. I learnt the image data contained the imageElement which could be used to convert the image to a tensor.

Using the tensor, I could then pass it into the classify method of the MobileNet model. The classify method returns a promise which resolves to an array of predictions. I then used the map method to get the top predictions and determined if the predictions included the string banana.

wtf_is_this's People

Contributors

cwarcup avatar

Stargazers

Levente Farkas avatar

Watchers

 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.