Merge pull request #40 from robmarkcole/add-face-register

Add face register
pull/42/head
Robin 2021-01-03 13:35:53 +00:00 committed by GitHub
commit 184e41f081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

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. The effect of various parameters can be explored, including filtering the classes of object detected, filtering by minimum confidence, and spatial filtering using a region of interest (ROI).
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).
<p align="center">
<img src="https://github.com/robmarkcole/deepstack-ui/blob/master/usage.png" width="1000">

View File

@ -97,6 +97,23 @@ if deepstack_mode == FACE:
st.subheader("All faces")
st.write(faces)
st.header("Deepstack Face registration")
INSTRUCTION = "First enter the name to register below then load the image"
ENTER_MESSAGE = "Enter name here"
face_name = st.text_input(label=INSTRUCTION, value=ENTER_MESSAGE)
if face_name != ENTER_MESSAGE:
st.write(f"Registering face {face_name}")
img_file_buffer_register = st.file_uploader(
"Upload an image to register", type=["png", "jpg", "jpeg"]
)
if img_file_buffer_register is not None:
try:
pil_image_register = Image.open(img_file_buffer_register)
image_bytes_register = utils.pil_image_to_byte_array(pil_image_register)
response = dsface.register(face_name, image_bytes_register)
st.write(response)
except ds.DeepstackException as exc:
st.write(exc)
elif deepstack_mode == OBJECT:
## Setup main