Giter Club home page Giter Club logo

360macky / scanner-cam Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 2.0 5.79 MB

๐Ÿ“น๐Ÿ”Š Web app recognizer of objects in camera. Also you can hear which objects are detected. And it works offline after first load!

Home Page: https://scanner.cam

License: MIT License

JavaScript 2.69% HTML 2.36% CSS 1.96% TypeScript 92.96% Shell 0.04%
camera machine-learning react react-webcam tensorflow-js single-shot-multibox-detector ssd tensorflow-experiments

scanner-cam's Introduction

Scanner Cam

๐Ÿ“ธ Scanner Cam ๐Ÿ”Š

๐Ÿ“ธ Camera object recognizer with object-to-voice integrated. ๐Ÿค–

โœ… This project has diagrams to help you understand how it works! ๐Ÿ“Œ

Demo of ScannerCam

www.scanner.cam

๐Ÿค– Concept

ScannerCam is a web application that uses the TensorFlow.js computer vision library to detect objects in real time with the camera of a mobile device or a computer. Built with Next.js, React, TypeScript, TailwindCSS, and Playwright.

๐Ÿ›  Core Development

graph TD
    A([User clicks Start app]) -->|Downloading TensorFlow model...| B[Model downloaded]
    B --> |App can work offline from here...|C[Camera button available]
    C --> D([User clicks on camera button])
    D --> E[Is camera access allowed?]
    E --> |No|C
    E --> |Yes|G[React-Webcam component rendered]
    G --> H[Tensorgram mechanism is started...]

These are the main technologies used to build ScannerCam:

๐Ÿง  Machine Learning

ScannerCam is a web application that contains a camera module (capable of reverting to environment camera and front camera on mobile devices) whose frames are fed in real time to the COCO-SSD model (COCO stands for Common Objects In Context) (SSD stands for Single Shot MultiBox Detection) of TensorFlow.js computer vision to detect up to 80 object classes.

SSD: Single Shot MultiBox Detector

"We present a method for detecting objects in images using a single deep neural network. Our approach, named SSD, discretizes the output space of bounding boxes into a set of default boxes over different aspect ratios and scales per feature map location." From the SSD: Single Shot MultiBox Detector paper.

When the user clicks the button "Start app", the app requests the Machine Learning Model from the TensorFlow.js Hub. The TensorFlow.js Hub then responds by sending the model's architecture and weights to the app.

Once the model is ready, it is not necessary to download it again. The model is stored in the browser's cache. This way, the app can work offline after the first load.

If you want to know more about the COCO-SSD model, you can read the TensorFlow.js documentation.

graph TD
    A(Tensorgram mechanism) --> B[Get the frames from the HTML video element]
    B --> |Sent to the TensorFlow.js model|C[(COCO SSD Detection Model)]
    C --> |Returns|D([Array of detections])
    D --> E[\Get classes detected/]
    E --> |Update useState|G[(Detections Storage)]
    D --> H[Create Diagrams with createTensorgram]
    H --> I[Create an overlay element on top of the React-Webcam component]
    I --> J[Paint boxes with text in the overlay element created]

๐ŸŽ™ Speech Synthesis

It also uses the Speech Synthesis API to talk about objects detected on camera while the option is active. This feature is called object-to-voice.

Both features have language internationalization support in English and Spanish. The language change happens by the user's preferred language in the browser.

๐Ÿช User Interface

ScannerCam UI was built on React v18 with TypeScript.

It is responsive. And it's also available with a beautiful light and dark mode based on the user's preferred color scheme in the browser.

โœ… Testing

ScannerCam is continuously tested with Playwright. Playwright is a Node.js library to automate Chromium, Firefox, and WebKit with a single API.

More than 10 assertions are made to ensure that the app is working correctly.

The tests are located in the tests folder.

๐Ÿ›ฉ Deployment

ScannerCam is deployed on Vercel. Vercel is a cloud platform for static sites, hybrid apps, and Serverless Functions.

๐ŸŽจ UI Design

ScannerCam has a simple and clean design. It is based on the Material Design guidelines.

The library used to build the interface is TailwindCSS. It is a utility-first CSS framework for rapidly building custom user interfaces.

The colors chosen to paint Scanner Cam are shades of red that change depending on the user's preference in dark mode and light mode.

  • Red darker: #6A0012
  • Red dark: #A00037
  • Red candydark: #D81B60
  • Red candylight: #FF5C8D
  • Red light: #FF90BD
  • Red lighter: #FFC2EF

๐Ÿคฒ Contributing

Do you would like to contribute? Do you want to be the author of a new feature? Awesome! please fork the repository and make changes as you like. Pull requests are warmly welcome.

๐Ÿ“ƒ License

Distributed under the MIT License.

See LICENSE for more information.

scanner-cam's People

Contributors

360macky avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

simrit1 shiba07s

scanner-cam's Issues

Create an "Start" button instead of async loading

ScannerCam loads automatically the TensorFlow.js model. This process was designed to decrease the number of actions the user has to perform in order to use the web app.

Unafortunately this design comes with the Time To Interactive problem. The user can't click on the web app.

The download of the TensorFlow.js model could take more than 4 seconds (it depends from the Internet speed connection). In the same time the user reads a message mentioning that the Computer Vision is loading.

Anyway during this loading the buttons are hided. And in a future design of this app, when the "Start" or "Play" button will be incorporated the buttons shouldn't be shown.

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.