Skip to content
This repository has been archived by the owner on Mar 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #46 from robmarkcole/add-debug
Browse files Browse the repository at this point in the history
add debug mode
  • Loading branch information
robmarkcole committed Jan 21, 2021
2 parents e642158 + e5c0ced commit eb55483
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The `deepstack-ui` is designed to be run in a docker container. The UI picks up
- DEEPSTACK_API_KEY : the API key of your deepstack instance, if you have set one
- DEEPSTACK_TIMEOUT : the timeout to wait for deepstack, default 30 seconds
- DEEPSTACK_CUSTOM_MODEL : the name of a custom model, if you wish to use one
- DEEPSTACK_UI_DEBUG_MODE : options `True` or `False` (default). Lowers the minimum confidence threshold to 1%
```

From the root dir, build the deepstack-ui container from source and then run the UI, passing the `DEEPSTACK_IP` environment variable:
Expand Down
28 changes: 19 additions & 9 deletions app/deepstack-ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@
import utils
import const

DEFAULT_CONFIDENCE_THRESHOLD = 0.45
MIN_CONFIDENCE_THRESHOLD = 0.1
## Depstack setup
DEEPSTACK_IP = os.getenv("DEEPSTACK_IP", "localhost")
DEEPSTACK_PORT = os.getenv("DEEPSTACK_PORT", 80)
DEEPSTACK_API_KEY = os.getenv("DEEPSTACK_API_KEY", "")
DEEPSTACK_TIMEOUT = int(os.getenv("DEEPSTACK_TIMEOUT", 30))
DEEPSTACK_CUSTOM_MODEL = os.getenv("DEEPSTACK_CUSTOM_MODEL", None)
DEEPSTACK_UI_DEBUG_MODE = bool(os.getenv("DEEPSTACK_UI_DEBUG_MODE", False))

if DEEPSTACK_UI_DEBUG_MODE:
st.title("IN DEEPSTACK_UI_DEBUG_MODE")
MIN_CONFIDENCE_THRESHOLD = 0.01
else:
MIN_CONFIDENCE_THRESHOLD = 0.1
MAX_CONFIDENCE_THRESHOLD = 1.0
DEFAULT_CONFIDENCE_THRESHOLD = 0.45
OBJECT_TEST_IMAGE = "street.jpg"
FACE_TEST_IMAGE = "faces.jpg"
FACE = "Face"
Expand All @@ -28,12 +40,6 @@
DEFAULT_ROI_X_MAX,
)

## Depstack setup
DEEPSTACK_IP = os.getenv("DEEPSTACK_IP", "localhost")
DEEPSTACK_PORT = os.getenv("DEEPSTACK_PORT", 80)
DEEPSTACK_API_KEY = os.getenv("DEEPSTACK_API_KEY", "")
DEEPSTACK_TIMEOUT = int(os.getenv("DEEPSTACK_TIMEOUT", 30))
DEEPSTACK_CUSTOM_MODEL = os.getenv("DEEPSTACK_CUSTOM_MODEL", None)

predictions = None

Expand Down Expand Up @@ -64,7 +70,7 @@ def process_image_face(pil_image, dsface):
)

if deepstack_mode == FACE:
st.title("Deepstack Face recogntion")
st.title("Deepstack Face recognition")

img_file_buffer = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"])
## Process image
Expand Down Expand Up @@ -249,3 +255,7 @@ def process_image_face(pil_image, dsface):

st.subheader("All filtered objects")
st.write(objects)

if DEEPSTACK_UI_DEBUG_MODE:
st.subheader("All predictions data from Deepstack")
st.write(predictions)

0 comments on commit eb55483

Please sign in to comment.