I have trained a model using images at 1200x1200 and the precision and recall as reported on the EI website are acceptable. The input image was set at 120x120 and when the model is run on the target device using the Raw Features of one of the training images it produces the expected predictions.
However when one of the training images is resized externally (using Irfanview) to 240x240 and then that image is downsized to 120x120 by the application firmware the model either fails to detect objects in it or the probability score is greatly reduced.
Does the method of downsizing of images affect prediction accuracy? Should I always use the ei function for this? Would there be advantages in downsizing by a power of 2 (eg 8x to 150x150) and retraining the model to 150x150 input size?
Alternatively, is it more likely there is some other reason for the poor results?
You should try to stick to our resizing as it happens before the model is trained, then that data is used to create the model you will need to match our resizing if you are doing so again, not sure how Irfanview handles things but that could be adding more issues on resizing, see if you can find out what Irfanview is doing or remove that step.
You can see exactly how it’s done in our open-source processing block here:
Resizing an image multiple times (e.g., 1200 > 240 > 120) also compounds data loss on the fine details in the image. So even if they do use the same method there will be loss doing an additional step
Checked out your project really quickly and noticed it was uploaded from S3 so you could hopefully use some of this information to improve your workflow. Let me know if you need any additional info around your hardware and workflow, we have a bunch of hardware specific guides.
See also our model optimization guidelines in the docs these sections should help -
Thanks Eoin, that’s helpful advice. I will review those docs tomorrow.
NB using IrfanView was just for testing and is not part of the final architecture. I just needed to scale down by a factor of 5 for the test. But that may be where errors have been introduced.
Am I right in thinking that I can pass images of any size into run_classifier and it will resize as necessary internally? I need to grab a 1200x1200 JPG image from the camera anyway so rather than resizing it myself I think I could convert to RGB888 (I will have just enough memory) and pass into run_classifier as the signal. Presumably I need to set signal.total_length to 1440000 rather than 120x120.
For better efficiency perhaps I should retrain the model at 150x150 so the scaling is 8X rather than 10x