classifyObjects
warning
The document is a continuation of the previous document, if you have landed directly on this page then, Please read from page Get started.
#
What is classifyObjects component ?classifyObjects component is used to classify object from an input image.
- Description : classifyObjects() takes an input as image in base64 format and N i.e. top N probability of classes with probabilities. Check Input and output parameters for details.
- Parameters :
- Input(Via STDIN) : A JSON String with following contents:
- Input1 : Image (.jpg/.png) in base64 format
- Input2 : N : Top N class predictions (value between 1 to 1000)
- Output(Via STDOUT) : A JSON string with following contents
- For each object in top n
- Score/Probabillity
- Index
- int responseID
- For each object in top n
- Input(Via STDIN) : A JSON String with following contents:
#
List of classifyObjects features in shunya stack- Set N, get top N predictions
- Get class data.
classifyObject
#
Using classifyObject
#
Requirements to use - Shunya OS installed (supported Arm devices) or Shunya OS docker container (X86 based windows/linux devices)
- Shunya AI installed in Shunya OS.
classifyObject
#
Steps to use - Set input image location.
- Customize top N prediction value.
- Get class data
note
Run the steps given below inside Shunya OS installed (supported Arm devices) or Shunya OS docker container (X86 based windows/linux devices) terminals.
Lets take an example use case: Say we need to
- Get top N classes predictions
- Get JSON output of classified object.
Steps are
#
Step 1: Set location of the input image for object classificationStart with an ready to use template for classifying objects from image.
Open the examples in a text editor and modify as per your usecase.
- For CPP you will find the examples in the folder
cpp-examples/object-classification/classifyObjects
- Open the file
classify_objects.cpp
- Modify the line to set the location of the input image
- For Python you will find the examples in the folder
python-examples/object-classification/classifyObjects
- Open the file
classify_objects.py
- Modify the line to set the location of the input image
- For CPP you will find the examples in the folder
#
2. Customize top N prediction value.Open the examples in a text editor and modify as per your usecase.
- For CPP you will find the examples in the folder
cpp-examples/object-classification/classifyObjects
- Open the file
classify_objects.cpp
- Modify the line to set the N.
- For Python you will find the examples in the folder
python-examples/object-classification/classifyObjects
- Open the file
classify_objects.py
- Modify the line to set N.
- For CPP you will find the examples in the folder
#
Step 3: Get class data.Once you are done editing, save and run the code, by running
Running the codes will print the JSON output on the terminal (to STDOUT).
For Example:
Lets say the input image is
Input JSON is
Then the JSON output is
#
Related Components to classifyObjects that you may need to complete your application- no related components