def start(self): # Do not change width = 352 height = 352 # output to capture image output = np.empty((height, width, 3), dtype=np.uint8) # Init camera camera = Camera(width, height) # Init image saver imageSaver = ImageSaver() # Init model model = self.getModel() # Init notificator notificator = Notificator() # Start predicting tempCount = 1 while True: #print("Step...") #start = time.time() # Capture image to output camera.capture(output) imageToCrop = Image.fromarray(output) image = self.cropImage(imageToCrop, 110, 87, 224) tempName = 'temp{}.jpg'.format(tempCount) image.save(tempName) tempCount += 1 if tempCount > Notificator.PREDICTIONS_LENGTH: tempCount = 1 # Predict prediction = model.predict(imagePath=tempName) # Save image to disk with label and probability imageSaver.save(image, prediction) # Manage Notification notificator.manageNotification(prediction) #print("Step took {} seconds".format(time.time()-start)) camera.close()