-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathvisualminer.py
44 lines (38 loc) · 1.22 KB
/
visualminer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from __future__ import print_function
import os
import os.path
import sys
from pipeline import Pipeline, MultiPipelineExecutor
# - Pipelines:
# - deepdetect + basicdetect + facerecognize
# - deepdetect only
# - deepdetect + basicdetect
# - basicdetect only
# - basicdetect + facerecognize
# - facetrain
#
# User inputs:
# - for detection/recognition:
# - Input directory containing photos and videos
# - Output directory for reports
# - Pipeline file
#
# - for deep detection training
# - TODO
#
# - for face recognition training
# - input images directory
# - size of training images
def detect(input_path, output_directory, pipeline_file):
# if input_path is just a single file, we don't need all the multicore
# setup.
if os.path.isfile(input_path):
pipeline = Pipeline(pipeline_file, os.path.dirname(input_path), output_directory)
pipeline.execute(input_path)
elif os.path.isdir(input_path):
multiexecutor = MultiPipelineExecutor()
multiexecutor.execute(pipeline_file, input_path, output_directory)
else:
print("Input is not an image file or directory:", input_path)
if __name__ == '__main__':
detect(sys.argv[1], sys.argv[2], sys.argv[3])