Compare commits

...

37 Commits
v0.6 ... master

Author SHA1 Message Date
Robin Cole 9a1f5c29b4
Create FUNDING.yml 2022-07-05 05:22:21 +01:00
Robin 7bfcf3a2d1 unpin streamlit 2022-04-13 06:04:04 +01:00
Robin Cole 14aacea642
Merge pull request #69 from legovaer/patch-1
Use the correct docker image (fixes #68)
2022-02-25 05:52:24 +00:00
Levi Govaerts 9776672e3f
Use the correct docker image (fixes #68) 2021-11-30 04:00:27 +01:00
Robin 94e8d0109e
Merge pull request #63 from michaelarnauts/dockerfile
Slim down Dockerfile
2021-09-02 07:08:55 +01:00
Robin Cole 9bf136f14e Create Dockerfile.arm 2021-09-02 07:08:12 +01:00
michaelarnauts 61dba38b15 Slim down Dockerfile 2021-08-02 14:22:52 +02:00
Robin e515d4d667
Merge pull request #55 from MaleNurse/master
Potential for arm64 w/ updated Readme
2021-03-03 15:08:02 +00:00
MaleNurse b3c6b1a8b4
Final revision to add ARM
Revert readme.md
rebase to stock ubuntu:20.04
install build tools
build pyarrow from source
clean up
2021-03-03 06:42:10 -08:00
MaleNurse f57e57ae96
Update Dockerfile 2021-03-01 12:12:20 -08:00
MaleNurse 840178b1d1
upd 2021-03-01 10:44:00 -08:00
MaleNurse 6ba72afc3a
Update Dockerfile 2021-03-01 09:23:23 -08:00
Zach McDonough 2b508e2b1e
Update Dockerfile.arm64
add second metadata label to ensure proper credit
2021-03-01 07:12:10 -08:00
Zach McDonough d05e62ffa4
Update README.md
Add link to Docker info on M1 chips
2021-03-01 07:08:39 -08:00
Zach McDonough 8b219a0b05
Update README.md 2021-02-28 23:00:42 -08:00
Zach McDonough a655b1e3e3
Update Dockerfile.arm64 2021-02-28 22:57:19 -08:00
Zach McDonough 3514360d57
Update README.md 2021-02-28 16:41:22 -08:00
Zach McDonough 19c114c933
Update README.md 2021-02-28 16:40:55 -08:00
Zach McDonough 070a8823b5
Update README.md 2021-02-28 16:40:35 -08:00
Zach McDonough 03d30362b1
Update Dockerfile.arm64 2021-02-28 16:06:15 -08:00
Zach McDonough 1f2a2a8785
Update Dockerfile.arm64 2021-02-28 16:01:21 -08:00
Zach McDonough f848a05e82
Update Dockerfile.arm64 2021-02-28 15:58:13 -08:00
Zach McDonough 97c0e905d9
Update Dockerfile.arm64 2021-02-28 15:57:42 -08:00
Zach McDonough 327b22eaea
Update Dockerfile.arm64 2021-02-28 15:54:07 -08:00
Zach McDonough 73edc027f2
Update Dockerfile.arm64 2021-02-28 15:40:35 -08:00
Zach McDonough da707b1716
Update Dockerfile.arm64 2021-02-28 15:16:01 -08:00
Zach McDonough 3d51064fcb
Update Dockerfile.arm64 2021-02-28 15:07:28 -08:00
Zach McDonough 82a1a837e6
Update Dockerfile.arm64 2021-02-28 15:05:59 -08:00
MaleNurse 53babc21d5
Create Dockerfile.arm64 2021-02-28 14:51:39 -08:00
Robin 2218620a08
Merge pull request #48 from robmarkcole/update-compose
Update compose
2021-01-26 19:40:34 +00:00
Robin Cole 0622271f91 Update README.md 2021-01-26 19:40:08 +00:00
Robin Cole 1cbda87a93 fix compose 2021-01-26 19:38:52 +00:00
Robin eb554837f4
Merge pull request #46 from robmarkcole/add-debug
add debug mode
2021-01-21 04:34:28 +00:00
Robin Cole e5c0ceded0 add debug mode 2021-01-21 04:28:58 +00:00
Robin e6421586c3
Update docker-image-deploy.yml 2021-01-21 03:57:32 +00:00
Robin Cole a52f02d6b5 Update reademe 2021-01-21 03:53:43 +00:00
Robin a8c9364351
Create docker-image-deploy.yml 2021-01-21 03:36:33 +00:00
9 changed files with 149 additions and 45 deletions

3
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,3 @@
# These are supported funding model platforms
github: robmarkcole

View File

@ -0,0 +1,37 @@
name: Docker Image CI
on:
release:
types: [created]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
main:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: robmarkcole/deepstack-ui:latest
build-args: |
arg1=value1
arg2=value2
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

3
.gitignore vendored
View File

@ -19,4 +19,5 @@ bin-release/
venv
.vscode
__pycache__*
.idea
__pycache__*

View File

@ -3,13 +3,12 @@ LABEL maintainer="Robin Cole @robmarkcole"
EXPOSE 8501
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN mkdir -p /app
COPY app /app
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY app /app
ENTRYPOINT [ "streamlit", "run"]
CMD ["deepstack-ui.py"]
CMD ["deepstack-ui.py"]

44
Dockerfile.arm Normal file
View File

@ -0,0 +1,44 @@
FROM ubuntu:20.04
LABEL maintainer="Robin Cole @robmarkcole"
EXPOSE 8501
WORKDIR /root
SHELL ["/bin/bash", "-c"]
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y apt-utils
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get install -y build-essential git wget sudo pkg-config curl dbus cmake vim nano python3 python3-pip python3-setuptools libjemalloc-dev libboost-dev libboost-filesystem-dev libboost-system-dev libboost-regex-dev autoconf flex bison libssl-dev llvm-10
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN ln -s /usr/bin/pip3 /usr/bin/pip
RUN pip install --upgrade pip
RUN pip install numpy==1.17.3 cython pygments==2.4.1
RUN export ARROW_HOME=/usr/local/lib
RUN export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
WORKDIR /root
RUN wget --no-check-certificate https://github.com/apache/arrow/archive/apache-arrow-3.0.0.tar.gz
RUN tar -xvf apache-arrow-3.0.0.tar.gz
RUN mkdir -p /root/arrow-apache-arrow-3.0.0/cpp/build
WORKDIR /root/arrow-apache-arrow-3.0.0/cpp/build
RUN cmake -DCMAKE_INSTALL_PREFIX=$ARROW_HOME -DCMAKE_INSTALL_LIBDIR=lib -DARROW_WITH_BZ2=ON -DARROW_WITH_ZLIB=ON -DARROW_WITH_ZSTD=ON -DARROW_WITH_LZ4=ON -DARROW_WITH_SNAPPY=ON -DARROW_PARQUET=ON -DARROW_PYTHON=ON -DARROW_BUILD_TESTS=OFF ..
RUN make -j4
RUN make install
WORKDIR /root/arrow-apache-arrow-3.0.0/python
RUN python setup.py build_ext --build-type=release --with-parquet
RUN python setup.py install
WORKDIR /root
RUN rm -R *
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN apt-get remove -y build-essential wget pkg-config apt-utils cmake vim nano libjemalloc-dev libboost-dev libboost-filesystem-dev libboost-system-dev libboost-regex-dev autoconf flex bison libssl-dev
RUN apt-get autoremove -y
RUN mkdir -p /app
COPY app /app
WORKDIR /app
ENTRYPOINT [ "streamlit", "run"]
CMD ["deepstack-ui.py"]

View File

@ -1,5 +1,5 @@
# deepstack-ui
UI for working with [Deepstack](https://python.deepstack.cc/). Allows uploading an image and performing object detection or face recognition with Deepstack. Also faces can be registered with Deepstack. The effect of various parameters can be explored, including filtering filtering by confidence, the classes of object detected, and spatial filtering using a region of interest (ROI).
UI for working with [Deepstack](https://github.com/johnolafenwa/DeepStack). Allows uploading an image and performing object detection or face recognition with Deepstack. Also faces can be registered with Deepstack. The effect of various parameters can be explored, including filtering objects by confidence, type and location in the image.
<p align="center">
<img src="https://github.com/robmarkcole/deepstack-ui/blob/master/usage.png" width="1000">
@ -7,12 +7,11 @@ UI for working with [Deepstack](https://python.deepstack.cc/). Allows uploading
## Run deepstack
Run deepstack object detection:
```
docker run -e VISION-DETECTION=True -p 5000:5000 -e API-KEY="" -e MODE=High deepquestai/deepstack:latest
docker run -e VISION-DETECTION=True -p 80:5000 deepquestai/deepstack:latest
```
You will need the ip address of the machine running deepstack, which is passed to the Streamlit app using an environment variable.
You will need the ip address of the machine running deepstack, which in my case is `192.168.1.133`.
## Run deepstack-ui with Docker
The `deepstack-ui` is designed to be run in a docker container. The UI picks up the information about your deepstack instance from environment variables which are passed into the container using the `-e VARIABLE=value` approach. All environment variables that can be passed are listed below:
@ -20,13 +19,17 @@ The `deepstack-ui` is designed to be run in a docker container. The UI picks up
- DEEPSTACK_IP : the IP address of your deepstack instance, default "localhost"
- DEEPSTACK_PORT : the PORT of your deepstack instance, default 80
- DEEPSTACK_API_KEY : the API key of your deepstack instance, if you have set one
- DEEPSTACK_TIMEOUT : the timeout to wait for deepstack, default 10 seconds
- 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:
```
docker build -t deepstack-ui .
OR
docker pull robmarkcole/deepstack-ui:latest
docker run -p 8501:8501 -e DEEPSTACK_IP='192.168.1.133' deepstack-ui
```
The UI is now viewable at [http://localhost:8501](http://localhost:8501) (not whatever ip address is shown in the logs, this is the internal docker ip)
@ -41,6 +44,9 @@ docker run -p 8501:8501 \
deepstack-ui
```
## Docker-compose
An example docker-compose file is provided. For run commands see [here](https://docs.docker.com/compose/gettingstarted/#step-8-experiment-with-some-other-commands) but the main one you need is `docker-compose up`.
### FAQ
Q1: I get the error: `TypeError: cannot unpack non-iterable DeepstackException object`

View File

@ -9,9 +9,21 @@ import deepstack.core as ds
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"
@ -28,12 +40,6 @@ DEFAULT_ROI = (
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", 20))
DEEPSTACK_CUSTOM_MODEL = os.getenv("DEEPSTACK_CUSTOM_MODEL", None)
predictions = None
@ -64,7 +70,7 @@ CONFIDENCE_THRESHOLD = st.sidebar.slider(
)
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
@ -249,3 +255,7 @@ elif deepstack_mode == OBJECT:
st.subheader("All filtered objects")
st.write(objects)
if DEEPSTACK_UI_DEBUG_MODE:
st.subheader("All predictions data from Deepstack")
st.write(predictions)

View File

@ -1,22 +1,26 @@
deepstack:
container_name: deepstack
restart: unless-stopped
image: deepquestai/deepstack
ports:
- '5000:5000'
environment:
- VISION-DETECTION=True
- API-KEY=""
volumes:
- /srv/docker/deepstack:/datastore
deepstack_ui:
container_name: deepstack_ui
restart: unless-stopped
image: robmarkcole/deepstack-ui
environment:
- DEEPSTACK_IP=deepstack
- DEEPSTACK_PORT=5000
- DEEPSTACK_API_KEY=""
- DEEPSTACK_TIMEOUT=20
ports:
- '8501:8501'
version: "3.9"
services:
deepstack:
container_name: deepstack
restart: unless-stopped
image: deepquestai/deepstack
ports:
- '5000:5000'
environment:
- VISION-DETECTION=True
- API-KEY=""
volumes:
- /Users/robin/Data/pytorch-models:/modelstore/detection
deepstack_ui:
container_name: deepstack_ui
restart: unless-stopped
image: robmarkcole/deepstack-ui:latest
environment:
- DEEPSTACK_IP=deepstack
- DEEPSTACK_PORT=5000
- DEEPSTACK_API_KEY=""
- DEEPSTACK_TIMEOUT=20
- DEEPSTACK_CUSTOM_MODEL=fire
- DEEPSTACK_UI_DEBUG_MODE=True
ports:
- '8501:8501'

View File

@ -1,4 +1,4 @@
numpy>=1.18.5
Pillow>=7.1.2
deepstack-python==0.8
streamlit==0.73.0
streamlit