Applications - Update
  • 22 Dec 2023
  • 5 Minutes to read
  • Dark
    Light

Applications - Update

  • Dark
    Light

Article summary

Applications can be updated by posting to the application endpoint with application_id and any attributes you want to change. The following are the attributes that can be changed. Note that application_id and type cannot be changed once an application is created.

An application JSON object with complete attributes is returned.

Name

Example

Description

name
string

"Person detector"

Name should be brief and descriptive

description
string

"Find people walking
 into the front door"

A full description of the purpose of the application. Use this field to capture detailed subjects and any exceptional feedback instructions.

input_subjects
array

["flicker_cats",
 "animals_pics"]

Array of
 input subjects id's (note that input subjects' must be already created and have a valid id before adding to an Application)

output_subjects
array

["cat","dog","face"]

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
string

"best_F1"

The performance measure used to assess model performance.
 
 Must be one of 'best_recall', 'best_precision', 'best_F1'.
 
 Defaults to 'best_F1'

detection_
 thresholds

dictionary

{"cat": 0.5,
 "dog": 0.7,
 "face": 0.5}

Map between subjects 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_
 post_urls

array

["http://127.0.0.1:99/
 my_model_output.net", "https://detections-now.com/detections"]

A list of URL's where model detections will be surfaced in addition to web and iOS interfaces.
 
 Posts are retried for thirty seconds, but URL's that fail retried posts after thirty seconds are blacklisted for five minutes.

gateway_
 post_urls

array

["http://127.0.0.1:99/
 my_model_output.net", "https://detections-now.com/detections"]

A list of URL's where model detections will be surfaced from the gateway.
 
 Posts are retried for thirty seconds, but URL's that fail retried posts after thirty seconds are blacklisted for five minutes.
 
 Specifying a gateway post URL implies that the gateway will implement the application along with any linked applications.

Gateway Models
Staging Model ID
Production Model ID
string

"Hpo-d-8e49-DmDT9hhuJLSiFuWOge-YN-OW_mtsv1_INT_10000.tgz"

Specify a model for gateway use. Both fields can be left blank in which case the gateway will use the latest model used in cloud infrastructure for inference. This model can either be a production or staging. Production models are considered stable; staging models can be used to validate against a known set of results prior to being migrated to production. These processes are customer-driven.

active
bool

true

Flag to control if the application is active or not. Inactive applications do not process images submitted to their input subjects or request feedback.

requested_
 feedback_per_hour

integer

50

Override the target rate of feedback to surface per hour.

 A Null or value indicates the system feedback rate should be used.
 
 The default value is Null: system selects feedback rate.
 
 Select a higher value to schedule more feedback feedback requests or a lower value to schedule fewer feedback requests.

refresh_feedback
bool

false

Flag to control whether the new model should re-evaluate the images waiting for user feedback when a new model is released.

app_managers
array

["user1@email.com", "user2@email.com"]

List of user email addresses, the users are given the app_manager role that is authorized to manage application settings and maintain feedback control.

Update Application

POST /1/applications/{application_id}
Host: https://api.cogniac.io

Example: Update an Application

curl -X POST https://api.cogniac.io/1/applications/di71rG94 \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
-H "Content-Type: application/json" \
-d '{
  "name":"Test App Updated",
  "description":"Application Description Updated",
  "output_subjects":["cat","dog"],
  "release_metrics":"best_F1",
"detection_thresholds":{"cat": 0.5, "dog": 0.7} 
}' \ 
| json_pp
import cogniac

# connect to the tenant
cc = cogniac.CogniacConnection(username="testuser@cogniac.co", 
                               password="password", 
                               tenant_id="abcdefghijk")

# get the app object
my_app = cc.get_application('m6fqjxjn')

# Add new subject with the 'add_input_subjects' method
new_subj = cc.create_subject('horse')
my_app.add_input_subject(new_subj)

# Update application attribbutes
# by updating Cogniac app object attributes
my_app.name = 'Test App Updated'
my_app.description = 'Application Description Updated'
my_app.detection_thresholds = {"cat": 0.5, "dog": 0.7, new_subj.subject_uid: 0.5}

{
   "active" : true,
   "app_managers" : [
      "testuser@cogniac.co"
   ],
   "app_type_config" : {
      "fps_requirement" : null,
      "model_constraint_types" : null,
      "output_top_N" : 1,
      "show_heatmap" : true
   },
   "application_id" : "rjcrnrgi",
   "candidate_model_count" : 0,
   "consensus_release_id" : null,
   "consensus_release_timestamp" : null,
   "created_at" : 1701128008.92167,
   "created_by" : "testuser@cogniac.co",
   "current_performance" : null,
   "custom_fields" : {
      "evaluate_training" : false,
      "gateway_lower_detection_probability" : 0,
      "gateway_upper_detection_probability" : 0.5,
      "show_heatmap" : true
   },
   "description" : "Application Description Updated",
   "detection_post_line_users" : [],
   "detection_post_urls" : [
      "http://example.com/cogniac-post"
   ],
   "detection_thresholds" : {
      "cat" : 0.5,
      "dog" : 0.7
   },
   "drop_input_focus" : false,
   "edgeflow_upload_policies" : [],
   "feedback_resample_ratio" : null,
   "gateway_post_urls" : [],
   "gpu_memory_gigabytes" : null,
   "gpu_throughput_megapixels_per_second" : null,
   "hpo_credit" : 0,
   "inference_execution_policies" : {
      "max_batch" : 8,
      "replicas" : 1,
      "runtime_policy" : {
         "gpu_selection_policy" : "by-free-memory",
         "gpu_simul_load" : 1,
         "model_load_policy" : "realtime",
         "model_seconds" : 0,
         "rtc_timeout_seconds" : 5
      }
   },
   "input_queue_count" : 0,
   "input_subjects" : [],
   "input_threshold" : null,
   "last_candidate_at" : null,
   "last_eval_time" : null,
   "last_released_at" : null,
   "max_gpu_throughput_megapixels_per_second" : null,
   "model_id" : null,
   "model_image_id" : null,
   "model_initialization_time_seconds" : null,
   "model_runtime_image" : null,
   "modified_at" : 1701128008.92167,
   "name" : "Test App Updated",
   "output_subjects" : [
      "dog",
      "cat"
   ],
   "output_subjects_external_ids" : {},
   "override_upstream_detection_filter" : false,
   "production_gateway_model_id" : "disabled",
   "realtime" : false,
   "refresh_feedback" : false,
   "release_metrics" : "best_F1",
   "release_model_count" : 0,
   "replay" : false,
   "requested_feedback_per_hour" : null,
   "staging_gateway_model_id" : "disabled",
   "system_feedback_per_hour" : 0,
   "tenant_id" : " abcdefg.hijk",
   "training_data_count" : null,
   "training_summary" : {
      "training_in_progress" : 0
   },
   "type" : "classification",
   "validation_data_count" : null
}


Was this article helpful?