lab2/inference_client/sample-client-file-mqtt.py [22:41]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
img = cv2.imread(sys.argv[1])
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
cv2.imwrite('frame.bmp',img) # this lets you verify the image compared is what you think it was
print("start client")
with grpc.insecure_channel("unix:///tmp/aws.iot.lookoutvision.EdgeAgent.sock") as channel:

   print("channel set")
   stub = EdgeAgentStub(channel)
   h, w, c = img.shape
   print("shape="+str(img.shape))
   response = stub.DetectAnomalies(
      pb2.DetectAnomaliesRequest(
            model_component="ComponentCircuitBoard",
            bitmap=pb2.Bitmap(
                width=w,
                height=h,
                byte_data=bytes(img.tobytes())
                ) 
            )
   )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



lab2/inference_client/sample-client-file.py [12:30]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
img = cv2.imread(sys.argv[1])
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
cv2.imwrite('frame.bmp',img)
print("start client")
with grpc.insecure_channel("unix:///tmp/aws.iot.lookoutvision.EdgeAgent.sock") as channel:
    print("channel set")
    stub = EdgeAgentStub(channel)
    h, w, c = img.shape
    print("shape="+str(img.shape))
    response = stub.DetectAnomalies(
        pb2.DetectAnomaliesRequest(
                model_component="ComponentCircuitBoard",
                bitmap=pb2.Bitmap(
                    width=w,
                    height=h,
                    byte_data=bytes(img.tobytes())
                    ) 
                )
    )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



