Skip to content

Commit

Permalink
Merge pull request #26 from datarootsio/bugfix
Browse files Browse the repository at this point in the history
Bugfix
  • Loading branch information
baturayo authored Oct 23, 2020
2 parents 1942ed2 + 36a7b7f commit 11d3a31
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 126 deletions.
30 changes: 4 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ Follow the steps below, to run the entire pipeline.
```
git clone https://github.com/datarootsio/face-mask-detection.git
cd face-mask-detection
tar xvfz data.tar.gz
mkdir data
tar -xvf data.tar.gz -C ./data
pip install -r requirements.txt
```
After completing these steps, you can run and play with the model in `scripts/predict.ipynb` notebook.
Expand All @@ -124,32 +125,9 @@ If you want to recreate the `data` folder and retrain `masked or not masked` cla
5. Run `predict.ipynb` to run entire pipeline and see an example output of face mask detection model.

## Getting Started for Calling Deployed Face Mask Detection Model
The model has been deployed in the [dploy.ai](dploy.ai) platform. By making a REST call, you can provide your image and get the prediction response.

The input should have the following format:

```
{
image: <Base64 Image String>,
type: <Image Type e.g. jpg, jpeg, png>
}
```
The response will have the following format:
```
{
'detected_face_coordinates': <the bounding box coordinates of the detected faces e.g.
[[x1, y1, x2, y2], [x1, y1, x2, y2]]>,
'detected_mask_scores': <the prediction score of the detected faces between 0 and 1 e.g.
["0.8", "0.99", "0.001"]>,
'detected_face_labels': <human readible classification results of the detected faces e.g.
[masked, masked, not masked]>,
'annotated_image': <annotated base64 image that visualizes the prediction results with
bounding boxes and text labels>,
'image_type': <Image Type e.g. jpg, jpeg, png>
}
```

The model is ready to be deployed using [dploy.ai](dploy.ai) platform. `dploy.ai` is a brand new deployment platform where you can dploy your ML models super easily. Please follow [`this guide`](https://docs.dploy.ai/docs) to deploy an example model.

You can also easily deploy this repo locally using the open sourced [`dploy-kickstart`](https://docs.dploy.ai/docs/python#4-testing-dploy-locally).

## Contact
Ping us:
Expand Down
4 changes: 2 additions & 2 deletions data.tar.gz
Git LFS file not shown
23 changes: 1 addition & 22 deletions dploy.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
model_id: d36795f9-0376-4a4a-bc05-0fb964ee229b
description: |
Face masks are crucial in minimizing the propagation of COVID-19, and are highly recommended or even obligatory in many situations.
This deployed model gives access to dataroots' [open-sourced](https://github.com/datarootsio/face-mask-detection) face mask detection project.
You can interactively test the model below. Or you can use the model via through our API with the following steps:
1. Subscribe to this model
2. Copy your user-id and api-key tokens
3. Perform the following request
```sh
curl --request POST \
--url https://${modelversion_id}.users.dploy.ai/ \
--header 'content-type: application/json' \
--header 'x-api-key: <insert your api key>' \
--header 'x-api-user: <insert your api id>' \
--data '{"image": "<insert your base64string>", "type": "png"}'
```
For an example of how to use this within your application, check out our [examples](https://github.com/dploy-ai/dploy-examples)
spec_version: "0.1"
spec_version: v2
spec:
environment:
base: python:3.7
entrypoint: scripts/predict.ipynb
requirements: ["requirements.txt"]
replicas: 1
max_replicas: 5
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tensorflow==2.1.2
tensorflow==2.3
numpy==1.18.2
opencv-python==4.2.0.34
PyYAML==5.3.1
Expand All @@ -14,4 +14,4 @@ googledrivedownloader==0.4
face-detection==0.1.4
tqdm==4.44.1
pandas==1.0.3
face_detection==0.1.4
face-recognition==1.3.0
Binary file modified scripts/img/artificially_masked_toon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified scripts/img/confusion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified scripts/img/ex_img_annotated.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified scripts/img/roc_classification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions scripts/predict.ipynb

Large diffs are not rendered by default.

119 changes: 64 additions & 55 deletions scripts/prep-data.ipynb

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions scripts/train-mask-nomask.ipynb

Large diffs are not rendered by default.

0 comments on commit 11d3a31

Please sign in to comment.