-simply run process to not need external script
authorEric Zavesky <ezavesky@research.att.com>
Fri, 17 Nov 2017 22:31:32 +0000 (16:31 -0600)
committerEric Zavesky <ezavesky@research.att.com>
Fri, 17 Nov 2017 22:31:32 +0000 (16:31 -0600)
README.md
bin/run_face-privacy-filter_reference.py [deleted file]
bin/run_local.sh [deleted file]
face_privacy_filter/_version.py
face_privacy_filter/filter_image.py
setup.py

index bba12b1..efb5076 100644 (file)
--- a/README.md
+++ b/README.md
@@ -47,19 +47,19 @@ composed together for operation.
 
 * Dump the `detect` model to disk.
 ```
-./bin/run_local.sh -d model_detect -f detect
+python face_privacy_filter/filter_image.py -d model_detect -f detect
 ```
 * Dump the `pixelate` model to disk.
 ```
-./bin/run_local.sh -d model_pix -f pixelate
+python face_privacy_filter/filter_image.py -d model_pix -f pixelate
 ```
 * Evaluate the `detect` model from disk and a previously produced detect object
 ```
-./bin/run_local.sh -d model_detect -p output.csv -i web_demo/images/face_DiCaprio.jpg
+python face_privacy_filter/filter_image.py -d model_detect -p output.csv -i web_demo/images/face_DiCaprio.jpg
 ```
 * Example for evaluating the `pixelate` model from disk and a previously produced detect object
 ```
-./bin/run_local.sh -d model_pix -i detect.csv -p output.jpg --csv_input
+python face_privacy_filter/filter_image.py -d model_pix -i detect.csv -p output.jpg --csv_input
 ```
 
 ### Installation Troubleshoting
diff --git a/bin/run_face-privacy-filter_reference.py b/bin/run_face-privacy-filter_reference.py
deleted file mode 100755 (executable)
index 4e48510..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#! python
-# -*- coding: utf-8 -*-
-"""
-Command line code for face privacy filter
-"""
-
-from face_privacy_filter.filter_image import main
-
-if __name__ == "__main__":
-    main()
diff --git a/bin/run_local.sh b/bin/run_local.sh
deleted file mode 100755 (executable)
index 01387d7..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-#------------------------------------------------------------------------
-#  run_local.sh - locally starts a face privacy filter instance
-#------------------------------------------------------------------------
-
-# infer the project location
-MODEL_DIR=$(dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) )
-echo "Local run directory '$MODEL_DIR'..."
-
-# inject into python path and run with existing args (for unix-like environments)
-PYTHONPATH="$MODEL_DIR:$PYTHONPATH" python $MODEL_DIR/bin/run_face-privacy-filter_reference.py $*
index 592027f..5d54d20 100644 (file)
@@ -1,3 +1,3 @@
 # -*- coding: utf-8 -*-
-__version__ = "0.2.0"
+__version__ = "0.2.1"
 MODEL_NAME = 'face_privacy_filter'
index 947eb58..a2cf86b 100644 (file)
@@ -10,10 +10,6 @@ import sys
 import numpy as np
 import pandas as pd
 
-from face_privacy_filter.transform_detect import FaceDetectTransform
-from face_privacy_filter.transform_region import RegionTransform
-from face_privacy_filter._version import MODEL_NAME
-
 
 def model_create_pipeline(transformer):
     from acumos.session import Requirements
@@ -47,6 +43,9 @@ def model_create_pipeline(transformer):
 
 
 def main(config={}):
+    from face_privacy_filter.transform_detect import FaceDetectTransform
+    from face_privacy_filter.transform_region import RegionTransform
+    from face_privacy_filter._version import MODEL_NAME
     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument('-p', '--predict_path', type=str, default='', help="save detections from model (model must be provided via 'dump_model')")
@@ -73,13 +72,13 @@ def main(config={}):
 
         # formulate the pipeline to be used
         model_name = MODEL_NAME + "_" + config['function']
-        if 'push_address' in config and config['push_address']:
+        if config['push_address']:
             from acumos.session import AcumosSession
             print("Pushing new model to '{:}'...".format(config['push_address']))
             session = AcumosSession(push_api=config['push_address'], auth_api=config['auth_address'])
             session.push(pipeline, model_name, reqs)  # creates ./my-iris.zip
 
-        if 'dump_model' in config and config['dump_model']:
+        if config['dump_model']:
             from acumos.session import AcumosSession
             from os import makedirs
             if not os.path.exists(config['dump_model']):
@@ -126,4 +125,8 @@ def main(config={}):
 
 
 if __name__ == '__main__':
+    # patch the path to include this object
+    pathRoot = os.path.dirname(os.path.basename(os.path.abspath(__file__)))
+    if pathRoot not in sys.path:
+        sys.path.append(pathRoot)
     main()
index 1130fdb..81c8e5e 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -19,8 +19,7 @@ setup(
     description=("Face detection and privacy filtering models"),
     long_description=("Face detection and privacy filtering models"),
     license="Apache",
-    package_data={globals_dict['MODEL_NAME']: ['data/*']},
-    scripts=['bin/run_face-privacy-filter_reference.py'],
+    #package_data={globals_dict['MODEL_NAME']: ['data/*']},
     setup_requires=['pytest-runner'],
     entry_points="""
     [console_scripts]