Giter Site home page Giter Site logo

kevmo314 / magic-copy Goto Github PK

View Code? Open in Web Editor NEW
2.4K 2.4K 145.0 33.72 MB

Magic Copy is a Chrome extension that uses Meta's Segment Anything Model to extract a foreground object from an image and copy it to the clipboard.

License: MIT License

Shell 3.72% JavaScript 5.52% TypeScript 89.18% Dockerfile 0.50% HTML 0.31% Python 0.77%
chrome-extension computer-vision image-processing

magic-copy's Introduction

o shit waddup

magic-copy's People

Contributors

dependabot[bot] avatar kevmo314 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magic-copy's Issues

Docker instructions in README

docker run --gpus all -p 8000:8000 segment-anything

throws the following error

docker: Error response from daemon: No command specified.

I'm sure there's an obvious command to add to the end of that line but I've never used Docker so I don't know what command that would be. The included Dockerfile doesn't specify a command either.

Can't use on local files

Steps to reproduce:

  1. Open file from local file system, e.g. file:///C:/Users/home/Pictures/test.png
  2. Right click on the image and bring up Magic Copy
  3. Once magic copy is up, notice that clicking on any part of the image does not extract any objects

Manifest unreadable error when trying to install

I tried to install the extension on chrome by following these steps.

Alternatively, the extension can be installed manually:

Download the repository as a ZIP file.
Extract the ZIP file.
In Chrome, go to chrome://extensions/, enable "Developer mode", and click "Load unpacked".
Select the folder where the extension was extracted.

After enabling developer mode and selecting "Load unpacked", I get this error:

Failed to load extension
File ~\Downloads\magic-copy-main
Error Manifest file is missing or unreadable
Unable to load manifest.

I've tried deleting, downloading and extracting the zip file again, but that didn't work. When loading unpacked I'm selecting the folder where the files were extracted, not the zip file.
I'm using Chrome version 112.0.5615.50 64 bits (latest).
Any ideas of what could be causing this?

Release on Firefox Add-ons Store

This issue will close when the extension is available on the Firefox Add-ons Store. If you would like to be notified, hit the "Subscribe" button in the sidebar.

No build script in package.json causing execution errrors in command line and Dockerfile

"scripts": { "watch:chrome": "webpack --config webpack/webpack.chrome.dev.js --watch", "build:chrome": "webpack --config webpack/webpack.chrome.prod.js", "watch:firefox": "webpack --config webpack/webpack.firefox.dev.js --watch", "build:firefox": "webpack --config webpack/webpack.firefox.prod.js", "watch:figma": "webpack --config webpack/webpack.figma.dev.js --watch", "build:figma": "webpack --config webpack/webpack.figma.prod.js" },

The above has no "build" script. So when you run npm run build from the README you get an error npm ERR! Missing script: "build". And when you run docker build -t segment-anything . you get the same error because the Dockerfile runs npm run build

The obvious quick fix is to rename your browser of choice to build:

"scripts": { "watch": "webpack --config webpack/webpack.chrome.dev.js --watch", "build": "webpack --config webpack/webpack.chrome.prod.js", "watch:firefox": "webpack --config webpack/webpack.firefox.dev.js --watch", "build:firefox": "webpack --config webpack/webpack.firefox.prod.js", "watch:figma": "webpack --config webpack/webpack.figma.dev.js --watch", "build:figma": "webpack --config webpack/webpack.figma.prod.js" },

But I'm wondering if there's a more elegant solution? Like mapping build to build:chrome for instance on initial setup.

Sorry if anything I said is imprecise or there's an obvious solution, I'm new to a lot of these tools

Fix CORS restrictions on Firefox

For some reason, Firefox seems to be very unhappy with the cross-origin requests out of the background script from the extension. I've posted about this here: https://discourse.mozilla.org/t/bypassing-cors-restrictions-on-background-scripts/113839/2

But I have no idea how to fix this after a few hours of trying different approaches. I don't think we can reliably do the fetch in the content script either.

This appears to be the last remaining issue for Firefox support.

Option to crop to selected mask

Hey! First off, love the implementation and thanks for your work. Glad to see local mode implemented.

When selecting smaller parts of a larger image, the overall image size remains the same. It'd be great to be able to trim the transparent edge pixels so the resulting file doesn't need further cropping or editing in an external program. Making it an option would be best for people who want to keep the same image size for easy overlaying/compositing.

Release on Chrome Web Store

This issue will close when the extension is available on the Chrome Web Store. If you would like to be notified, hit the "Subscribe" button in the sidebar.

Suggestion - Integrate MobileSAM into the pipeline for lightweight and faster inference

Reference: https://github.com/ChaoningZhang/MobileSAM

Our project performs on par with the original SAM and keeps exactly the same pipeline as the original SAM except for a change on the image encode, therefore, it is easy to Integrate into any project.

MobileSAM is around 60 times smaller and around 50 times faster than original SAM, and it is around 7 times smaller and around 5 times faster than the concurrent FastSAM. The comparison of the whole pipeline is summarzed as follows:

image

image

Best Wishes,

Qiao

Suggestion: SAM-HQ + Negative

Will you please consider to upgrade to SAM-HQ it is much more accurate.
Also adding a Negative for small segments that are unwanted will be very appreciated.

Thanks ahead and please keep up the good work!๐Ÿ’™

iframes are also triggered

It seems like Magic Copy triggers other iframes in addition to the main body. We should track the contextmenu events and only trigger on the iframe that contains the image matching the source url.

buildcrx.sh

how to use this file? According to the process, the Google plugin cannot be loaded

The compiled source code cannot run properly. ort.min.js:1802 wasm streaming compile failed: LinkError: WebAssembly.instantiate(): Import #36 module="a" function="K": function import requires a callable

Hello, I downloaded the source code of your open-source project magic-copy from releases/tag/v1.2.0 and installed dependencies locally. After running npm run watch and adding the plugin to Google Chrome, I found that it doesn't work properly. It shows an error like the one in the screenshot below.
Snipaste_2024-02-19_14-00-40

However, if I download the compiled magic-copy-chrome.zip from releases/tag/v1.2.0 and install it directly in the browser, it works fine. I also checked the format of onnxruntime-web inside sandbox.js and found that they are different. Could this be an issue with the version of onnxruntime-web? I tried upgrading to the latest version of onnxruntime-web, but the issue persists.
Snipaste_2024-02-19_14-06-28

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.