Platform commands enable you to interact directly with the Deepomatic web platform from your terminal. Here is the list of actions that you can do:
add-images: upload images and their metadata directly from your local machine
model: use the Deepomatic cloud API to run inferences on your trained models (infer, draw or blur based on the type of output that you require)
app: interact with visual automation applications (create or delete applications)
app-version: interact application versions (create or delete application versions)
service: add services to your visual automation applications
In order to use the Deepomatic CLI tool, you need to set the DEEPOMATIC_API_KEY
variable in your terminal. It will be used to authenticate yourself while communicating with the Deepomatic product. You can set it in your .bashrc
file (or equivalent) to save it locally.
For add-images
and model
commands:
Connect to studio.deepomatic.com. On the top right, click on your user and go to My account
In the Credentials section, Generate the API Key if necessary and copy the API KEY value of your organization.
Copy this value and set it as your environment variable by running this line in your terminal:
export DEEPOMATIC_API_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$Env:DEEPOMATIC_API_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
For app
, app-version
and service
commands:
Please contact the Deepomatic support to get your API KEY.
First, you will need to retrieve the org
(organization name) and project_name
from Deepomatic platform. This is the destination project for the upload. Simply go into the project and retrieve the URL which will contain the project name: https://studio.deepomatic.com/<org>/project-views/<project_name>/views
.
To upload all images directly to the specified project
, you can specify either:
A single image file to be uploaded.
A directory, in which case all images directly inside the directory will be uploaded.
All images in the directory and subdirectories using the --recursive
option
Upload simple images to Deepomatic Platform# Upload simple imagedeepo platform add-images -o org -p myproject -i myimage.jpg# Upload all images in directorydeepo platform add-images -o org -p myproject -i mydir# Upload all images in directory and subdirectoriesdeepo platform add-images -o org -p myproject -i mydir --recursive
Sometime you will already have information regarding the images that you'd like to upload along the image. That could be information for pretagging the image, preexisting bounding boxes or metadata such as image provenance.
In order to pass it along with the image during upload time, you will need to use the text dataset format (which used to be a JSON format), more information about the format can be found on the Deepomatic Studio text file upload.
The text file format is not supported yet, but will be very soon. In the meantime, old JSON format are still supported to add metadata to not annotated images. More about the old JSON format here
Each model version is deployed as a web API after it has been trained on the platform. To run some inferences and evaluate the performances of your trained model version, you can use Deepomatic CLI.
Drawing a prediction with Deepomatic APIdeepo platform model infer -i img.jpg -o pred.json -r 12345
There are three different model actions that you can use:
infer
: Compute predictions only.
draw
: Display the prediction result, whether tags or the bounding boxes.
blur
: Blur the inside of the bounding boxes.
They follow the same recipe:
Retrieve one or several inputs.
Compute predictions using the trained neural network
Output the result in different formats: image, video, JSON, stream, etc.
Generic commanddeepo platform model infer -i myinput -o myoutput1 myoutput2 ...
The Deepomatic CLI supports different types of input:
Image: Supported formats include bmp
, jpeg
, jpg
, jpe
,png
, tif
and tiff
.
Video: Supported formats include avi
, mp4
, webm
and mjpg
.
Studio JSON: Deepomatic Studio JSON format, used to specify several images or videos stored locally.
Sample input JSON format{"images": [{"location": "/path/to/img.jpg"},{"location": "/path/to/video.mp4"},]}
Directory: Analyse all images and videos found in the directory.
Digit: Retrieve the stream from the corresponding device. For instance, 0 for the installed webcam.
Network stream: Supported network streams include rtsp
, http
and https
.
Inputs are specified using the -i
for input
option. Below an example with each type of inputs.
Sample input commandsdeepo platform model infer -i /path/to/my_img.bmp ... # Imagedeepo platform model infer -i /path/to/my_vid.mp4 ... # Videodeepo platform model infer -i /path/to/my_studio.json ... # Studio JSONdeepo platform model infer -i /path/to/my_dir ... # Directorydeepo platform model infer -i 0 ... # Device numberdeepo platform model infer -i rtsp://ip:port/channel ... # RTSP stream
The Deepomatic CLI supports different types of output:
Image: Supported formats include bmp
, jpeg
, jpg
, jpe
,png
, tif
and tiff
.
Video: Supported formats include avi
and mp4.
Run JSON: Deepomatic Run JSON format for raw predictions.
Studio JSON: Deepomatic Studio JSON format for Studio-like prediction scores. This is specified using the -s
or --studio_format
option.
Integer wildcard JSON: A standard Run/Studio JSON, except that the name contains the frame number. For instance -o frame %03d.json
will output frame001.json
, frame002.json
, ...
String wildcard JSON: Same as the integer wildcard except this time the frame name is used. For instance -o pred_%s.jpg
will output pred_img1_123.json
, pred_img2_123.json
, ...
Standard output: On rare occasions you might want to output the model results directly to the process standard output using the stdout
option. For instance this allows you to stream directly to vlc.
Display output: Opens a window and displays the result. Quit with q
.
Output are specified using the -o
for output
option. Below an example with each type of inputs.
Please note that in order to avoid duplicate computations, it is possible to specify several outputs at the same time, for instance to blur an image and store the predictions.
Sample output commandsdeepo platform model draw -i img.jpg -o img_drawn.jpg ... # Imagedeepo platform model draw -i vid.mp4 -o img_drawn_%04d.jpg ... # Wildcard imagesdeepo platform model draw -i vid.mp4 -o vid_drawn.mp4 ... # Videodeepo platform model draw -i img.jpg -o pred.json ... # Run JSONdeepo platform model draw -i img.jpg -o pred.json -s ... # Studio JSONdeepo platform model draw -i vid.mp4 -o pred_%s.json ... # String wildcard JSONdeepo platform model draw -i vid.mp4 -o pred_%04d.json ... # Integer wildcard JSONdeepo platform model draw -i vid.mp4 -o stdout ... # Standard outputdeepo platform model draw -i vid.mp4 -o window ... # Display outputdeepo platform model draw -i vid.mp4 -o vid_drawn.mp4 pred_%04d.json ... # Multiple outputs
Commands have additional options that you can use with a flag. There is a short flag -f
and a long flag --flag
. Note that one use a simple -
while the other uses two --
. Also some options need an additional argument. Find below the option table. When indicated, all
means that all three commands infer
, draw
and blur
are concerned.
Short | Long | Commands | Description |
|
|
| Input consumed. |
|
|
| Input FPS used for video extraction. |
|
|
| Number of frames to skip in-between two frames. |
|
|
| Recursive directory search. |
|
|
| Outputs produced. |
|
|
| Output FPS used for video reconstruction. |
|
|
| Convert from Run to Studio format. |
|
|
| Fullscreen if window output. |
|
|
| Use prediction from precomputed JSON. |
|
|
| Model version ID. |
|
|
| Threshold for predictions. |
|
|
| Overlay prediction score. |
|
|
| Do not overlay prediction score. |
|
|
| Overlay the prediction label. |
|
|
| Do not overlay the prediction label. |
|
|
| Blur method, |
|
|
| Blur strength. |
|
|
| Increase output verbosity. |
To create an application using the Deepomatic CLI, you need to provide a name, a workflow.yaml
file and optionally a custom_nodes.py
file.
Create an applicationdeepo platform app create -n my-first-workflow-app -w workflow.yaml [-c custom_nodes.py]
Delete an applicationdeepo platform app delete -a app_id
To create an application version using the Deepomatic CLI, you need to specify the application for which you want to create a version, a name and the list of model version ids that should be used within your application version.
Create an application versiondeepo platform app-version create -a app_id -n v1 -r 63555 63556
The model version ids must be added in the same order as the models are listed in the workflow file.
Delete an application versiondeepo platform app delete -a app_version_id
The update
command updates the app_version of a site in the api.
Update an application version of a sitedeepo site update -s site_id -a app_version_id
To add services to your application after you have created it, you need to use the service
commands.
Add a service to your applicationdeepo platform service create -a app_id -n service_name
Here is the list of the services you can add to your application:
workflow-server: this is one of the key component of the Deepomatic software infrastructure. It is in charge of orchestrating all workflow operations.
worker-nn: this is also one of the key component of the Deepomatic software infrastructure. It is in charge of handling all neural network inferences.
customer-api: this is an optional component that you need to add when you want to create a web API on top of your workflow.
camera-server: this is an optional component that you need to add when you want to connect cameras to workflow.