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

Widget object detection #247

Merged
merged 57 commits into from
Sep 16, 2021
Merged

Widget object detection #247

merged 57 commits into from
Sep 16, 2021

Conversation

mishig25
Copy link
Contributor

@mishig25 mishig25 commented Aug 2, 2021

Implemented object detection widget.

Request to Inference API (same as input for Image Classification widget):

const requestBody = { file }; // file is an image file

Response from Inference API:

Array<{ 
    label: string; 
    score: number;
    box: {xmin: number; ymin: number; xmax: number; ymax: number;} 
}>

Sample output:

[
  {"score": 0.9982, "label": "remote", "box": {"xmin": 40, "ymin": 70, "xmax": 175, "ymax": 117}},
  {"score": 0.9955, "label": "couch", "box": {"xmin": 0, "ymin": 1, "xmax": 639, "ymax": 473}},
  {"score": 0.9987, "label": "cat", "box": {"xmin": 345, "ymin": 23, "xmax": 640, "ymax": 368}}
]

Screenshots:

initial state success state fail state
Screenshot 2021-09-09 at 16 02 43 Screenshot 2021-09-09 at 16 01 26 Screenshot 2021-09-09 at 16 03 37

Check out the interactive netlify demo

cc: @Narsil @NielsRogge @osanseviero please feel free to make any UX suggestions

@mishig25 mishig25 added the widgets About our Inference widgets label Sep 14, 2021
@beurkinger
Copy link
Contributor

The image can overflow on mobile resolutions
Screen Shot 2021-09-15 at 11 29 48 AM

@beurkinger
Copy link
Contributor

On mobile, when I click on a selection box it both select the box AND open the file selection screen.

Some ideas for a work around:

  • when an image have been uploaded to the dropzone, hide the "dropzone" component and display a "remove" button or icon to reset the state
  • deactivate mouse clicks on the uploaded image through css (pointer-events: none; if memory serves me well), except for the selection boxes

Copy link
Contributor

@beurkinger beurkinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments :)

@mishig25
Copy link
Contributor Author

mishig25 commented Sep 15, 2021

@beurkinger

  1. fixed the mobile overflow issue
  2. regarding On mobile, when I click on a selection box it both select the box AND open the file selection screen.
    This only happens if you are switching to mobile chrome dev tools after the page is loaded (i.e mobile is being checked onMount). That is to say, this issue won't happen on an actual mobile phone. Try changing to chrome mobile dev tools and reload the page (the problem won't happen) widgetdropzone gets excluded on mobile devices here

@beurkinger
Copy link
Contributor

Two things that bother me a little bit :

  • lack of consistency between the two "Browse for image" inputs on mobile (see screenshot below)
  • the HTML rendered by the backend for the Object Detection input is different than the one applied by the FE, and you can see the transition between the two

Screen Shot 2021-09-15 at 4 21 07 PM

@beurkinger
Copy link
Contributor

beurkinger commented Sep 16, 2021

Almost there ! The current CSS solution work great for desktop and mobile, BUT doesn't work on tablets.

That being said, I have the solution: I just remembered that I had added a tailwind screen breakpoint util (or whatever it is called) to the moon-landing tailwind.config.js file, while trying to resolve exactly the same sort of issue:

screens: {
	'with-hover': { raw: '(hover: hover)' },
	'no-hover': { raw: '(hover: none)' },
},

So if you have the right tailwind config, you should to do stuff like with-hover:absolute instead of using size breakpoints !

Copy link
Contributor

@beurkinger beurkinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment, let's discuss it !

Copy link
Contributor

@beurkinger beurkinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice !

@mishig25 mishig25 merged commit 90e628f into main Sep 16, 2021
@mishig25 mishig25 deleted the widget-object-detection branch September 16, 2021 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
widgets About our Inference widgets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants