Showing
1 changed file
with
11 additions
and
3 deletions
| ... | @@ -6,6 +6,14 @@ | ... | @@ -6,6 +6,14 @@ |
| 6 | #***************************************************** | 6 | #***************************************************** |
| 7 | """ A sample lambda for bird detection""" | 7 | """ A sample lambda for bird detection""" |
| 8 | from threading import Thread, Event | 8 | from threading import Thread, Event |
| 9 | +#***************************************************** | ||
| 10 | +# * | ||
| 11 | +# Copyright 2018 Amazon.com, Inc. or its affiliates. * | ||
| 12 | +# All Rights Reserved. * | ||
| 13 | +# * | ||
| 14 | +#***************************************************** | ||
| 15 | + | ||
| 16 | +from threading import Thread, Event | ||
| 9 | import os | 17 | import os |
| 10 | import json | 18 | import json |
| 11 | import numpy as np | 19 | import numpy as np |
| ... | @@ -94,9 +102,9 @@ def infinite_infer_run(): | ... | @@ -94,9 +102,9 @@ def infinite_infer_run(): |
| 94 | model_name = "image-classification" | 102 | model_name = "image-classification" |
| 95 | ret, model_path = mo.optimize(model_name, input_width, input_height, aux_inputs={'--epoch': 5,'--precision':'FP16'}) | 103 | ret, model_path = mo.optimize(model_name, input_width, input_height, aux_inputs={'--epoch': 5,'--precision':'FP16'}) |
| 96 | # Load the model onto the GPU. | 104 | # Load the model onto the GPU. |
| 97 | - client.publish(topic=iot_topic, payload='Loading bird detection model') | 105 | + client.publish(topic=iot_topic, payload='Loading model') |
| 98 | model = awscam.Model(model_path, {'GPU': 1}) | 106 | model = awscam.Model(model_path, {'GPU': 1}) |
| 99 | - client.publish(topic=iot_topic, payload='Bird detection loaded') | 107 | + client.publish(topic=iot_topic, payload=' loaded') |
| 100 | # The number of top results to stream to IoT. | 108 | # The number of top results to stream to IoT. |
| 101 | num_top_k = 3 | 109 | num_top_k = 3 |
| 102 | # Define the detection region size. | 110 | # Define the detection region size. |
| ... | @@ -159,6 +167,6 @@ def infinite_infer_run(): | ... | @@ -159,6 +167,6 @@ def infinite_infer_run(): |
| 159 | cloud_output[output_map[obj['label']]] = obj['prob'] | 167 | cloud_output[output_map[obj['label']]] = obj['prob'] |
| 160 | client.publish(topic=iot_topic, payload=json.dumps(cloud_output)) | 168 | client.publish(topic=iot_topic, payload=json.dumps(cloud_output)) |
| 161 | except Exception as ex: | 169 | except Exception as ex: |
| 162 | - client.publish(topic=iot_topic, payload='Error in bird detection lambda: {}'.format(ex)) | 170 | + client.publish(topic=iot_topic, payload='Error : {}'.format(ex)) |
| 163 | 171 | ||
| 164 | infinite_infer_run() | 172 | infinite_infer_run() | ... | ... |
-
Please register or login to post a comment