이민규

Update lambda_yoga_project.py

......@@ -6,6 +6,14 @@
#*****************************************************
""" A sample lambda for bird detection"""
from threading import Thread, Event
#*****************************************************
# *
# Copyright 2018 Amazon.com, Inc. or its affiliates. *
# All Rights Reserved. *
# *
#*****************************************************
from threading import Thread, Event
import os
import json
import numpy as np
......@@ -94,9 +102,9 @@ def infinite_infer_run():
model_name = "image-classification"
ret, model_path = mo.optimize(model_name, input_width, input_height, aux_inputs={'--epoch': 5,'--precision':'FP16'})
# Load the model onto the GPU.
client.publish(topic=iot_topic, payload='Loading bird detection model')
client.publish(topic=iot_topic, payload='Loading model')
model = awscam.Model(model_path, {'GPU': 1})
client.publish(topic=iot_topic, payload='Bird detection loaded')
client.publish(topic=iot_topic, payload=' loaded')
# The number of top results to stream to IoT.
num_top_k = 3
# Define the detection region size.
......@@ -159,6 +167,6 @@ def infinite_infer_run():
cloud_output[output_map[obj['label']]] = obj['prob']
client.publish(topic=iot_topic, payload=json.dumps(cloud_output))
except Exception as ex:
client.publish(topic=iot_topic, payload='Error in bird detection lambda: {}'.format(ex))
client.publish(topic=iot_topic, payload='Error : {}'.format(ex))
infinite_infer_run()
......