Support selecting Object Detection models
It is going to take me a while to implement #1354 as I've got a lot to learn about the project and the tools :sweat_smile:
This (draft) PR is for part 1 of the implementation. It focuses on adding a model selection interface for models that exist in photonvision_config/models/. Upon completion we can ship more than 1 model and users could upload their own through ssh without deleting the shipped model.
TODO List
- [x] Initial rewrite
NeuralNetworkModelManager - [x]
RknnDetectionPipeparameters - [x] Frontend UI ~~- [ ] Update docs~~
Removing documentation milestone from this PR because there are likely to be a lot of object detection changes this year making any docs I write out of date by the time the fall comes around.
Sadly I think I need to click the approve workflow button every time you push until you make at least one contribution
Sadly I think I need to click the approve workflow button every time you push until you make at least one contribution
Skill issue on my part. Sorry!
What do we think about the design for defining model labels?
note-640-640-yolov5s-labels.txt
note-640-640-yolov5s.rknn
My thought process is that someday when we are able to support uploading models in different formats we might see something like:
note-640-640-yolov5s-labels.txt
note-640-640-yolov5s.onnx
note-640-640-yolov5s.rknn
note-640-640-yolov5s.tflite
I think that potential conflict (with keeping track of label names/number of classes across different model types with the same name) makes me a little scared.
different model types
What I'm going for is all those files encode the same "model" - just in different file formats. The difference between onnx and rknn isn't topological, both have the same weights & structure, it's just they use a different format for encoding.
The metadata format I'm going for is name-width-height-model.format.
The alternative is you have multiple copies of the same model (keyed by '"name"`) and you risk screwing up writing the labels file.
I feel pretty good about the implementation so far. I have a question, how can I go about getting the list of available models from core to the client? I need to give the UI a List<String>.
Ready for review - if someone is able to test this code running on hardware that would be great.
At the moment this is hung up on extracting models from the JAR. There is some kind of platform dependency - I'll work through it and move on to testing the actual implementation.
I'm preparing a more reviewable patch set!
@mcm001 I think this is the minimum abstractions needed to start #1340 and the uploading part of #1354
To have a second model to test with I just copied the existing one but slightly changed the name.
cp photon-server/src/main/resources/models/note-640-640-yolov5s.rknn photon-server/src/main/resources/models/note-640-640-yolov5m.rknn
cp photon-server/src/main/resources/models/note-640-640-yolov5s-labels.txt photon-server/src/main/resources/models/note-640-640-yolov5m-labels.txt