- 22 Dec 2023
- 5 Minutes to read
- Print
- DarkLight
Applications - Create
- Updated on 22 Dec 2023
- 5 Minutes to read
- Print
- DarkLight
Applications Create
Applications can be created by posting to the application endpoint with the following arguments: only name and type are required. Input and output subjects are optional, but the application is not helpful until they are specified. And they can only be specified if the subjects already exist.
An application JSON object with complete attributes is returned.
Name | Example | Description |
---|---|---|
name | "Person detector" | (required) Name should be brief and descriptive |
type | "classification" | (required) Cogniac appliction type, see type string in valid application type below |
description | "Find people walking | (optional) A full description of the purpose of the application. Use this field to capture detailed subject and any exceptional feedback instructions. |
input_subjects | ["flicker_cats", | (optional) Array of |
output_subjects | ["cat","dog","face"] | (optional) List of subject tags corresponding to objects, patterns, or features that are of interest in this application (note that output subjects' must be already created and have a valid id before adding to an Application) |
release_metrics | "best_F1" | (optional) The performance measure used when to assess model performance. |
detection_ | {"cat": 0.5, | (optional) Map between subject_uid's and associated probability thresholds. Detections below the specified probability threshold will not be forwarded to subsequent applications (if any). Detections below the threshold will not be posted to the detection_post_urls (if any). |
detection_ | ["http://127.0.0.1:99/ | (optional) A list of URL's where model detections will be surfaced in addition to web and iOS interfaces. |
gateway_ | ["http://127.0.0.1:99/ | (optional) A list of URL's where model detections will be surfaced from the gateway. |
active | true | (optional) Flag to control if the the application is active or not. Inactive applications do not process images submitted to their input subjects or requests feed back. |
requested_ | 50 | (optional) Override the target rate of feedback to surface per hour. |
refresh_feedback | false | (optional) Flag to control whether the images waiting for user feedback should be re-evaluated by the new model when a new model is released. |
app_managers | ["user1@email.com", "user2@email.com"] | _(optional)_List of user email address, the users are given the app_manager role that is authorized to manage application settings and maintain feedback control. |
Create Application
POST /1/applications
Host: https://api.cogniac.io
Example: Create a New Application
Application Subjects
The input and output subjects must already exist in the system. Otherwise the above call will result in and error. One can always create applications without input and output subjects and add them later with an application update.
import cogniac
# connect to the tenant
cc = cogniac.CogniacConnection(username="testuser@cogniac.co",
password="password",
tenant_id="abcdefghijk")
# create the application with keyword arguments
applications = cc.create_application(name='Test App',
application_type='classification',
description='App For Testing',
output_subjects=['cat', 'dog'])
# detection_post_urls="http://example.com/cogniac-post"
print(applications)
import requests
import json
from pprint import pprint
url_prefix = 'https://api.cogniac.io'
api_version = "1"
token = '' # add your token here
headers = {'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'}
application_data = {
"name": "Test App-Readme-Curl6",
"type": "classification",
"description": "App For Testing-Readme-Curl6",
"output_subjects": ["cat", "dog"],
"detection_post_urls": ["http://example.com/cogniac-post"]
}
url = f'{url_prefix}/{api_version}/applications'
res = requests.post(url, json=application_data, headers=headers)
if res.status_code == 200:
response_data = json.loads(res.content)
pprint(response_data)
else:
pprint(f"Error: {res.status_code}, {res.text}")
{
"application_id": "di71rG94",
"tenant_id": "abcdefghijk",
"name": "Test App",
"description": "App For Testing",
"type": "classification",
"release_metrics": "best_F1",
"output_subjects": [
"cat",
"dog"
],
"detection_thresholds": {
"dog": 0.0,
"cat": 0.0
},
"active": true,
"refresh_feedback": false,
"app_managers": [
"testuser@cogniac.co"
],
"detection_post_urls": [
"http://example.com/cogniac-post"
],
"gateway_post_urls": [],
"custom_fields": {},
"hpo_credit": 0,
"created_by": "testuser@cogniac.co",
"created_at": 1508537094.552487,
"modified_at": 1508537094.552487,
"system_feedback_per_hour": 0,
"requested_feedback_per_hour": null,
"release_model_count": null,
"best_model_ccp_filename": null,
"candidate_model_count": null,
"current_performance": null,
"last_candidate_at": null,
"last_released_at": null,
"training_data_count": null,
"validation_data_count": null,
"replay": false,
}
Valid Application Types
Name | Type string | Description |
---|---|---|
Classification | classification | Classify the full input image as exactly one subject to the mutual exclusion of the other subjects |
Detection Full-frame | detection_fullframe | Detect the presence of one or more objects of interest in a full-frame image |
Detection | box_detection | Detection with bounding boxes |
Optical Character Recognition | ocr | reads a limited set of characters against a noisy real-world (non-document) image background |
Static Count | static_count | count number of objects of interest in an image |
Left Offset | offset_x | Measure the pixel distances from the LEFT frame edge to the subjects of interest |
Top Offset | offset_y | Measure the pixel distances from the TOP frame edge to the subjects of interest |
Point Detection | point | Locate a point coordinate for each object of interest |
Motion Detection | motion | Perform motion detection based on background subtraction |
Static Crop | static_crop | Perform a static crop at fixed coordinates. Negative numbers indicate the right-most or bottom pixel dimension of the image |
Network Camera | network_camera | Pull images from network cameras and capture to a subject. |
Capture images from twitter to the indicated subjects | ||
Video Segmentation | video_segmentation | Segment video files into individual frames or smaller segments |
Other application types available by special arrangement include:
Name | Type string | Description |
---|---|---|
Line Crossing | line_crossing | Counts the number of objects crossing lines set by users! A dynamic tracking app must be an immediate upstream app! |
Dynamic Tracking | dynamic_tracking | Track boxed objects in videos or real-time video streams! A detection app must be an immediate upstream app |
DroneDeploy Retiler | retiler | Recombine DroneDeploy plan tiles into larger sub-plans of their original plan. Sub-plan size is given by configuration items 'max_height' and 'max_width'. |
Static Focus | static_focus | Add the fixed focus on the media to indicate the area of interest to downstream apps. If a fixed coordinate is beyond the corresponding limit of the media, the focus at the coordinate will be set at the limit. If constant_focus_box_size is set to 1, the focus box's size will be maintained when a coordinate is beyond a media limit. If all the fixed coordinates are beyond the limits of media, no focus will be added. |
NSFW Detection | nsfw | Detect the presence of explicit (NSFW) content. |