def get_image(self): if self.done(): return None status = 0 try: status = client.get_image(self.token, self.get_idx + 1, 'images') res = 'images/%d.jpg'%(self.get_idx + 1) except Exception as e: print "Exception:", e res = '' self.get_idx += 1 print "Image download. Current idx:", self.get_idx return (self.get_idx, res)
try: prob = detector.predict(image) for idx, i in enumerate(image_id): output_probs[i] = float(prob[idx][1]) except: # send errors to the eval frontend logging.error("Image id failed: {}".format(image_id)) raise eval_cnt += len(image) if eval_cnt % 10 == 0: logging.info("Finished {} images".format(eval_cnt)) logging.info(""" ================================================================================ All images finished, showing verification info below: ================================================================================ """) # verify the algorithm output print(output_probs) # cal_score(output_probs) verify_output(output_probs) if __name__ == '__main__': celebA_spoof_image_iter = get_image() run_test(CelebASpoofDetector, celebA_spoof_image_iter)