-
-
Notifications
You must be signed in to change notification settings - Fork 111
New demo: cat detector #465
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
Conversation
This will detect if a cat is on the screen. By which I mean displayed on the screen, not sitting on your laptop. This is meant as a simple demo of using MSS for AI. It works as-is, but needs to be documented, and there's some bits that could do with cleanup. There are a lot of additional features that could be added, such as showing a window with bounding boxes, but that's probably more complexity than is called for here.
|
I like it, great inspiration! |
halldorfannar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent PR. Well documented, enjoyable to read. Just some minor improvements suggested.
demos/cat-detector.py
Outdated
| # Performance | ||
| # =========== | ||
| # | ||
| # The biggest determinant of performance is whether the model runs on a GPU or on the CPU. GPUs are extremely |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should mention here, right away, that this particular model will work on both? I know this becomes clearer in the end of this section, when GPU vs CPU performance comparisons are discussed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding to the next commit
demos/cat-detector.py
Outdated
| import torchvision.models.detection | ||
| import torchvision.transforms.v2 | ||
|
|
||
| # You'll also need to "pip install mss pillow". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than assume the user is leveraging pip (I'm a fan of uv) I would suggest the more general:
| # You'll also need to "pip install mss pillow". | |
| # You'll also need to install mss and pillow. |
This also aligns with the earlier text where pip is suggested but it is left open for the user how to do this specifically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer very specific commands in user examples, but I'll make the "pip" command an example rather than sounding like a requirement. I had kind of assumed that the user, if using something other than pip, would know how to adapt the command to their needs.
The reason I pointed the user to the PyTorch "Get Started" page wasn't to handle different package managers; that page still only gives commands for pip (plus building from source, and downloading C++ / Java packages). The main difference for our purposes is that it gives different --index-url flags depending on whether you want a CUDA, ROCm, or CPU-only build.
I'll make a change to soften the suggestion of package manager, but still leave the specific command present.
Co-authored-by: Halldor Fannar <halldorfannar@users.noreply.github.com>
My last version accidentally had an intermediate copy. This version prevents that.
This will detect if a cat is on the screen. By which I mean displayed on the screen, not sitting on your laptop.
This is meant as a simple demo of using MSS for AI. It works as-is, but needs to be documented, and there's some bits that could do with cleanup.
There are a lot of additional features that could be added, such as showing a window with bounding boxes, but that's probably more complexity than is called for here.
Changes proposed in this PR
./check.shpassed - N/A (doesn't check demos)