Comments (7)
@jasan-s - Great question! Something we should also point to in our documentation.
In general, here's what I would say (@yining1023 feel free to correct me if I'm wrong!):
- resolution @ 72 dpi I think is good/fine. Higher resolution probably won't help you more except make the processing times longer.
- Image size size wise, probably better to not have gigantic images (> 640px x 480px), so smaller the images the more manageable (< 640px x 480px) .
I hope this helps! I will keep this open so that we make sure to add:
- A note about image resolution and size
- A note about the number of training data limits (seems also to be a common question that pops up), see: ml5js/ml5-library#405, and ml5js/ml5-library#356
Thank you!
from ml5-website.
Hi @jasan-s, Good question!
I agree with @joeyklee. There is no specific requirement for image size or resolution.
From the library source code point of view:
- For the mobile net feature extractor: ml5.featureExtractor(‘mobileNet’).addImage(img) will crop the image from the center in 224x224 px.
- For KNN classifier, it doesn't transform the image in any way.
from ml5-website.
@yining1023 @joeyklee agree that it would be great addition to the docs. Since mobile net crops a square 224 px from the center it would be best to enforce the input(i.e live webcam feed) to be a square ratio. Because if the important area of the feature for classification lies outside the square then user adding those examples to model would be meaningless.
Would you both agree with the following steps of implementation:
- Force users webcam feed to be 1:1 square ratio (i.e 512x512) higher res for better user experience
- user clicks a button to train a class for KNN classifier. The 512x512 image is scaled to 214x214 sent to mobile net feature extractor. And the features are added to knn model. (User still seeing the higher res feed)
3)For testing predictions the user still sees the 512x512 feed and the same scaling down happens.
Important difference is that what user sees on screen is higher resolution but the same 1:1 square ratio then what is being used for building the model.
from ml5-website.
Because we want ml5 to be easy for beginners, we made the decision to handle all of the image cropping and resizing behind the scenes when sending an image to MobileNet. However, we probably should be more clear in the documentation as to what is going on as well as consider consistency with other systems. This came up when working with @irealva on compatibility with the new teachable machine which by default flips the webcam's image!
(@yining1023 re: KNN, I believe anytime an image is sent to MobileNet it has to be a 224x224 square image? KNNclassifier can, of course, accept other forms of data, but in terms of the features of an image extracted from MobileNet, the same constraints apply, yes?)
from ml5-website.
@shiffman yes! That is correct.
from ml5-website.
@shiffman agree that handling image normalizing within lib is good decision. seems to be done here mobilenetInfer function using image.resize_bilinear.
@shiffman @yining1023 @joeyklee Can you please confirm if the the below statements are true:
Statement: No mater what size and aspect ratio image is inputed to ml5, there is NEVER any image data loss in normalizing and resizing because align_corners
is set true?
Result: If above is true then ml5 users don't have to do any image manipulation and can carelessly send any image.
from ml5-website.
Transferred issue from ml5-library to ml5-website because the question has been answered and now we need to update the documentation.
from ml5-website.
Related Issues (20)
- Scroll position doesn't reset after page transitions HOT 2
- New PoseNet ml5.neuralNetwork() tutorial placement? HOT 2
- [Website Design] Tundi's Design Proposal
- Quickstart example for NeuralNetwork not working HOT 2
- Setup issue with node v12 HOT 4
- Plan to translate this site into other languages? HOT 12
- [devOps] Change branch name from master -> main HOT 2
- inputLabels must be an array (sketch: line 46)
- Links to "getting started" and "docs" on homepage are not working - they don't point to the right page HOT 3
- p5js link is broken https://editor.p5js.org/ml5/sketches/ml5_boilerplate HOT 1
- Update the links in the community page
- BLM overlay is too large on mobile HOT 1
- Hamburger menu bottom-aligned on Reference (Docs) pages.
- Update BLMSolidarityModal to remove inline styles
- Background and foreground colors do not have a sufficient contrast ratio
- Delete docs folder HOT 2
- Code of Conduct missing on website
- Organization of ml5 examples HOT 9
- Outdated dependencies
- RIP Atom - Update to Hello ml5.js - A gentle introduction to ml5 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ml5-website.