lobe / web-bootstrap

Bootstrap your Lobe machine learning model with our web starter project.
https://lobe.ai
MIT License
74 stars 31 forks source link

web app #18

Closed quantum-fusion closed 3 years ago

quantum-fusion commented 3 years ago

I ran the web app, but it opens the camera,

with Note Thumbs down Thumbs up

Screen Shot 2021-03-28 at 9 10 23 AM

It does not appear that the webcam detects anything.

What is this app supposed to do?

What pictures/labels are loaded into the model?

mbeissinger commented 3 years ago

Hi! Glad you got the app running -- the model loaded by default is just a toy placeholder one I made. You should replace it with your own by going to Use > Export > TensorFlow.js in your Lobe project and dragging the exported model.json, signature.json, and all the *.bin files to the public/model/ folder here.

quantum-fusion commented 3 years ago

@mbeissinger Yes, but my question, is if I drag my model that detects Cars and Trucks, and it sees a video camera of my face with the webcam, then, what would be the expected result? Would it be thumbs down?

mbeissinger commented 3 years ago

I would expect either a Car or Truck label -- the model is forced to pick one of the labels you supplied. They are being loaded from the signature.json file so make sure it also gets copied to the public/model folder from Lobe's TensorFlow.js export folder.

quantum-fusion commented 3 years ago

@mbeissinger I exported the model, and it now thinks that my face is a Truck. I am not sure that this is the intended behavior, but wonder if there might be a confidence level probability that might be able to be output. I can see how this might run on a mobile phone if the app was deployed in the cloud. Any ideas?

Screen Shot 2021-03-30 at 10 23 13 AM
mbeissinger commented 3 years ago

@quantum-fusion great! This model is performing image classification (https://docs.lobe.ai/docs/welcome/welcome#what-is-image-classification) -- which means it will give one of your labels to every image passing through. If you want the model to predict that there isn't a car or truck, you need to add another label with examples of 'other' or 'none': https://docs.lobe.ai/docs/improving/improving#why-is-there-always-a-prediction-even-when-nothing-is-in-the-image

The width of the green bar is the confidence value -- and those confidence values are forced to sum to 1 across all your supplied labels. So this image looks something like 80% truck, 20% car based on the images you used to train the model. I would recommend to collect as many images you can to train Lobe, and evenly split them between truck, car, and none.

This starter project is for running your model as a browser-based web app to save money on server costs in the cloud. If you wanted to run your model as a prediction REST API, see our Flask server starter here: https://github.com/lobe/flask-server