Changing the Computer Vision Model¶
The alwaysAI model catalog provides pre-trained machine learning models that enable developers to quickly prototype a computer vision application without the need to create a custom model first. To change the model in your application:
- 1. Update the app model dependency
Navigate to the model catalog and find the model you want to add, and click on the model name to see details. Copy the model ID and run it with the
alwaysai app models addcommand in your terminal. For example, to use the MobileNet SSD model, the full command would be:
$ aai app models add alwaysai/ssd_mobilenet_v1_coco_2018_01_28
To remove your old model, run the
alwaysai app models remove
$ aai app models remove alwaysai/mobilenet_ssd
To see the models that your app depends on, run the
alwaysai app show
$ aai app show Models: alwaysai/ssd_mobilenet_v1_coco_2018_01_28@2 Scripts: start => "python app.py"
- 2. Use the model in your application
The next step to using the new model in your application is simply to pass the model ID to the constructor of the object that will be using it.
PoseEstimationall take a model ID as input. Paste the model ID into your app.py file as an input parameter:
obj_detect = edgeiq.ObjectDetection("alwaysai/ssd_mobilenet_v1_coco_2018_01_28")
alwaysai app install command to make sure your models are
installed and the latest application code is available on your device.
If the model does not get installed or is not supported by the object you are using, you will get an error back telling you so.