Beispiel #1
0
def main_function():
    parser = argparse.ArgumentParser(
        description='Test a trained neuronal network.', )
    parser.add_argument('-i',
                        '--image',
                        action='store',
                        dest='image',
                        required=True,
                        help='The path to the input image file.')
    parser.add_argument('-g',
                        '--graph',
                        action='store',
                        dest='graph',
                        required=True,
                        help='The path to the graph file.')

    parser.add_argument('-l',
                        '--label',
                        action='store',
                        dest='label',
                        required=True,
                        help='The path to the label file.')

    args = parser.parse_args()

    for key, value in vars(args).items():
        check_file(value)

    detector = Detector(graph_file=args.graph, labels_file=args.label)
    image = Image.open(args.image)

    answer = detector.detect([image])
    print(answer)
Beispiel #2
0
 def load_convnet(self):
     self.convnet = Detector(labels_file=self.configuration.labels,
                             graph_file=self.configuration.network)
     if not self.configuration.word in self.convnet.labels:
         error_message = self.configuration.word + " is not in label file."
         logger.error(error_message)
         raise Exception(error_message)
Beispiel #3
0
def detector():
    return Detector()
Beispiel #4
0
 def load_convnet(self):
     self.convnet = Detector()
     if not self.search.word in self.convnet.labels:
         error_message = self.search.word + " is not in label file."
         self.logger.error(error_message)
         raise Exception(error_message)