Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object detection #22

Closed
abdou31 opened this issue Jun 24, 2020 · 7 comments
Closed

Object detection #22

abdou31 opened this issue Jun 24, 2020 · 7 comments

Comments

@abdou31
Copy link

abdou31 commented Jun 24, 2020

Hello ,
Can you please make a tutorial of object detection problem ??

@imfing
Copy link
Owner

imfing commented Jul 8, 2020

Please take a look at this issue #13. It might help

@IdeaKing
Copy link

IdeaKing commented Sep 3, 2020

@mtobeiyf I was able to go through the legacy version and create the object detection version. But I would really like an object detection version for the main (newer) page. Can you help walk me through any needed modifications? I don't know where to start as I have already tried creating an object detection version without anything working.

@imfing
Copy link
Owner

imfing commented Sep 3, 2020

@IdeaKing
It's basically similar to #13
First, you need to modify the prediction result as an image with bounding boxes.
https://github.com/mtobeiyf/keras-flask-deploy-webapp/blob/39144f7304c2fa76229e62b4b00f244115f4a8e4/app.py#L57-L58

In the predict() function in app.py, serialize the output image into a base64 string, replace the result with the base64 image.
https://github.com/mtobeiyf/keras-flask-deploy-webapp/blob/39144f7304c2fa76229e62b4b00f244115f4a8e4/app.py#L87

Modify the displayResult function in static/main.js. Here, you'll get the result from the above predict() function.
https://github.com/mtobeiyf/keras-flask-deploy-webapp/blob/39144f7304c2fa76229e62b4b00f244115f4a8e4/static/main.js#L131-L137

All you have to do is to modify the image-display using the displayImage() function.
Previously, I used this function to display the same image you choose from your computer. Now display it with your detection result image.
https://github.com/mtobeiyf/keras-flask-deploy-webapp/blob/39144f7304c2fa76229e62b4b00f244115f4a8e4/static/main.js#L96

Provide it with the returned base64 image in the result field. For example:

function displayResult(data) { 
  hide(loader); 
  displayImage(data.result, "image-display");
  imageDisplay.classList.remove("loading");
}

@IdeaKing
Copy link

IdeaKing commented Sep 3, 2020

@mtobeiyf Thank you so so much! It works perfectly. However, there's one problem, the output box is shaded. What should I change? Here's an example:
temp
Btw, I think you should also paste your previous comment in the readme after you close this issue/topic.

@imfing
Copy link
Owner

imfing commented Sep 3, 2020

@IdeaKing oh, just remove the loading class for the imageDisplay element at the last step:

function displayResult(data) { 
  hide(loader); 
  displayImage(data.result, "image-display");
  imageDisplay.classList.remove("loading");
}

I've corrected the above answer.

@IdeaKing
Copy link

IdeaKing commented Sep 3, 2020

@mtobeiyf Great! Thank you for all of the help.

@imfing imfing pinned this issue Sep 3, 2020
@imfing imfing closed this as completed Sep 3, 2020
@cuongngm
Copy link

cuongngm commented Sep 15, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants