[HN Gopher] Open source Background Remover: Remove Background fr...
       ___________________________________________________________________
        
       Open source Background Remover: Remove Background from images and
       video using AI
        
       Author : thunderbong
       Score  : 328 points
       Date   : 2023-05-06 05:58 UTC (17 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | Oras wrote:
       | Nice work. I like that you have listed all the resources in the
       | repo.
       | 
       | Side note, I checked your website and the about page is empty
       | 
       | https://backgroundremoverai.com/about/
        
         | nadermx wrote:
         | Updated the about us
        
         | MrThoughtful wrote:
         | The about page probably had the background on how the site was
         | created, who made it etc.
         | 
         | But then somehow it was removed.
        
           | selcuka wrote:
           | What we need is an open source background check software.
        
             | postsantum wrote:
             | Looking forward to comments under every post like "Uhh,
             | nice project but did you know the author was caught making
             | offensive jokes in 2012"
        
       | bennyp101 wrote:
       | Chucked this into a Dockerfile, and had a play with it. (Takes a
       | while for torch to download, had to set the pip default-timeout
       | higher)
       | 
       | Seems to work pretty well, there were some images I had where it
       | left a bit of a blur around hair, but overall it worked pretty
       | well on most of the ones I tried!
       | 
       | Chucked in imagemagik as well to do some trimming/colour
       | manipulation - works pretty nicely
        
         | dicknuckle wrote:
         | Might as well open a PR to add your dockerfile.
        
         | lucg wrote:
         | Could you share your Dockerfile please? I was planning to do
         | exactly the same thing with imagemagik as a complement.
        
           | bennyp101 wrote:
           | Sure, it was a quick test, but it works for me, YMMV
           | 
           | https://gist.github.com/benperiton/2d37ea18377a80f9b9768522d.
           | ..
        
       | smartmic wrote:
       | Alternative: https://www.remove.bg/
        
         | NaaYYs wrote:
         | Not open-source nor free. So I wouldn't really call this an
         | alternative.
         | 
         | At least https://baseline.is/tools/background-remover/ is free,
         | but not open-source either.
        
         | nidnogg wrote:
         | Once you run out of free "credits", they give you a tiny image
         | and you have to pay to get more for for full-res. For a while
         | that was all I had as far as AI bg removal goes and it was
         | quite frustrating.
        
           | stevesearer wrote:
           | We use it for the Zapier integration and it works pretty
           | well. Cloudinary has bg removal transformations too but the
           | color seemed to get degraded.
           | 
           | Would be happy to learn of an alternative!
        
       | croes wrote:
       | We will lose an import data source if we remove unwanted
       | backgrounds. Historical, forensic or just interesting.
        
         | dagmx wrote:
         | You assume that the new one would replace the original.
         | 
         | It's digital, both would exist. This simply makes it easier to
         | do something people have done manually since the invention of
         | the photograph, or even prior with print.
         | 
         | It's the equivalent of scissors or a razor blade but automated.
         | It's not even the first ML based solution, and doesn't do
         | anything that we don't already do every day for advertising or
         | film.
        
           | croes wrote:
           | It's not a new technique but more accessible and easier to
           | use and it get integrated into the photo apps.
           | 
           | You assume that people keep photos they don't want,
           | especially if they show "flaws" they don't like.
        
         | PufPufPuf wrote:
         | Do you have similar objections to image editors that are able
         | to do a rectangular crop?
        
           | croes wrote:
           | With crop you lose part of the picture, the one who took the
           | photo don't want that. With AI removal tools they lose
           | nothing.
        
       | sebastianavina wrote:
       | neat tool. thank you
        
       | EmilyHughes wrote:
       | Why is never a binary provided?
       | 
       | Me and 99% of users won't check the code for malicious behaviour
       | so I might as well run a binary from the web.
        
         | [deleted]
        
         | IshKebab wrote:
         | Because it's a Python project (like most AI code) and
         | distributing Python code in easily usable form is an absolute
         | nightmare.
        
           | martsa1 wrote:
           | I've not tried it with AI projects, but pyinstaller does a
           | usually pretty solid job of packing up most python projects,
           | and it's pretty simple to get started with.
        
             | simion314 wrote:
             | Will that package all the dependencies in?
             | 
             | I am not a python dev and testing AI stuff in Python made
             | me hate python ecosystem (not the language ) a lot. All
             | this new AI projects are made by enthusiaste, they depend
             | on a specific CUDA version, a specific A,B,D python lib
             | versions. Very often shit does not work anymore and you
             | need to google and hope other person was unlucky before you
             | and posted some commit version of the stuff that still
             | works.
             | 
             | My advice for people that test AI stuff, after you get it
             | working do not update, try if possible to install the new
             | version side by side and see if it works, it saves you the
             | pain to roll back to a good version.
        
               | whitemary wrote:
               | Better yet make a Dockerfile
        
             | Cyphase wrote:
             | I've packaged various AI/ML/PyTorch/TensorFlow things with
             | PyInstaller in the past. It took some hours of initial
             | work, but the result was good. Things might be easier now.
        
         | Gordonjcp wrote:
         | Deliberate barrier to entry.
         | 
         | If you're going to use something that needs a bit of technical
         | skill to operate correctly, you're going to need at least
         | enough skill to get it running.
         | 
         | Roads would be far safer if every car had some facility by
         | which you had to remove and refit some random engine or braking
         | system component correctly before it would start.
        
           | zamnos wrote:
           | Would roads be safer, or would there be more mechanics? They
           | seem like different skills.
        
             | Gordonjcp wrote:
             | Roads would be safer, because people would understand more
             | about their car that "PUSH BUTAN GO FAST"
        
             | CapstanRoller wrote:
             | Everyone would be too busy wrenching on their cars to drive
             | them
        
           | Tao3300 wrote:
           | Roads would be more dangerous. I put the work into my car,
           | I'll drive how I want.
        
         | Hard_Space wrote:
         | My problem is the assumption by authors that the project being
         | installed is the only one on the machine, and the fact that
         | projects get so tied to particular versions of libraries.
         | Therefore installing the PyTorch specified in this version is
         | likely to be injurious to other existing installations, unless
         | you handle it all in a Conda wrapper.
        
         | weinzierl wrote:
         | Besides what beagle3 wrote: Providing binaries for various
         | platforms is more work than you might think and the people who
         | like to do development work are rarely the same people that
         | like packaging and distribution. That's why developer and
         | maintainer are separate persons more often than not.
        
         | frenchman99 wrote:
         | Encouraging users to run some random binary from GitHub is a
         | really good way to spread all kinds of viruses. People should
         | only run binaries from trusted sources.
        
           | marginalia_nu wrote:
           | Compiling and running random git projects isn't that big of a
           | step up.
        
             | frenchman99 wrote:
             | You're totally right, it's just as bad, maybe even worse
             | because build tools sometimes ask for admin permissions.
             | People should ideally really on some kind of reputation
             | system or get software from trusted vendors.
        
               | ddtaylor wrote:
               | Like a package manager with maintainers, ie. Deb, RPM,
               | etc.
        
               | pmoriarty wrote:
               | Or like Apple's App Store or the Google Play Store?
               | 
               | All of these, along with those package managers have had
               | malware posted to them.
        
           | zamnos wrote:
           | You probably don't run _curl | sudo bash_ either but other
           | people have different threat models.
        
             | frenchman99 wrote:
             | I do sometimes, when the source is trustworthy.
        
         | input_sh wrote:
         | Linked somewhere in the middle of the README file:
         | https://backgroundremoverai.com/?lang=en
        
         | beagle3 wrote:
         | This is more than entitled behavior, it's downright harmful.
         | 
         | When (not if, when) binaries get trojanned, this causes blame
         | to be directed at the original author, and takes a lot of work
         | to explain that they are not at fault - this has happened in
         | many supposedly reputable download sites including SourceForge,
         | TUCOwS, Download.com and many others (yes, I haven't used
         | windows in 20 years or so, no idea what the hip new places are)
         | 
         | Say "thank you", and spend 10 more minutes yourself to set it
         | up (even if compilation takes 5 hours, it's usually 10 mins to
         | get it started). And then offer it for others, and handle the
         | ricochets when it gets trojanned with no wrong done by you.
         | 
         | If just 20 people adopted such a process, there would be 98%
         | less complaints of this kind.
        
           | jdthedisciple wrote:
           | How can a binary _I_ provided possibly be trojanned by
           | someone else?
           | 
           | Genuinely curious.
        
             | VWWHFSfQ wrote:
             | Trojaned installers by download.com were rampant back in
             | the day. They would take your program and wrap it up in a
             | nice little installer wizard and then also stuff a bunch of
             | adware and spyware in there with it
        
               | luizcdc wrote:
               | I don't understand what's the harm of having a releases
               | page with a binary and its md5 hash, or how that keeps
               | anyone from just compiling an unofficial binary
               | themselves and adding malware to it.
               | 
               | Anyone not technical enough to compile a binary has to
               | give up trying to use it or risk some unnoficially
               | distributed executable .
        
               | pmoriarty wrote:
               | An md5 can be created for the trojaned binary and be
               | posted along with it.
               | 
               | Not to mention that the md5 checksum is a very poor
               | choice for this purpose because of the ease of creating
               | md5 collisions.
        
               | hattmall wrote:
               | But not on the official page, right? And there's nothing
               | stopping someone from doing that now is there? I don't
               | see how the original authors providing binaries is less
               | secure than anything else.
        
               | pmoriarty wrote:
               | The official page can be hacked, and both malware and md5
               | of the malware can be placed there.
               | 
               | That's the whole point of using a cryptographic signature
               | backed by a web of trust instead of a mere hash.
        
               | thdespou wrote:
               | Yeah but still hackers can abuse SEO and direct visits to
               | their pages. If you are not careful you might
               | accidentally download a malicious binary.
        
               | zamnos wrote:
               | Sure, but what does that have to do with distributing
               | binaries off Github? Maybe if Bonzie Buddy and IE6 make a
               | comeback but I don't see that happening.
        
           | tredre3 wrote:
           | > If just 20 people adopted such a process, there would be
           | 98% less complaints of this kind.
           | 
           | Okay so if 20 people did the same work over and over it would
           | reduce 98% of the complaints.
           | 
           | Contrast that to if the author did the work once, it would
           | reduce 100% of the complaints!
        
           | Garcia98 wrote:
           | Providing a checksum along with the binary singlehandedly
           | solves your concerns, and you can add gpg signatures if you
           | want.
        
             | pmoriarty wrote:
             | A checksum can be falsified as easily as a binary, and so
             | can a signature. Only if you participate in a web or trust
             | are you theoretically better off... but most people don't,
             | so all such measures do is give a false sense of security.
        
           | nwoli wrote:
           | GitHub will take it down if it contains blatant malware so
           | it's not that big of a deal
        
             | VWWHFSfQ wrote:
             | Somebody would have to report that to them first though
        
         | nadermx wrote:
         | Had not thought to make a binary for this project. I will look
         | into this
        
       | nico wrote:
       | The photo worked great.
       | 
       | The video I tried couldn't be played or downloaded.
        
         | nadermx wrote:
         | The video must of not had a object in the beginning?
         | https://backgroundremoverai.com/results/205ef8ad6b0f4cfa8f66...
        
       | jiggywiggy wrote:
       | Canva has one, pretty good actually
        
       | rg111 wrote:
       | Can anyone suggest me an open source, free upscaler powered by
       | Deep Learning/AI?
        
         | addandsubtract wrote:
         | There's a list of upscaling models here, based on your content:
         | https://upscale.wiki/wiki/Model_Database
         | 
         | The easiest one to get started with is probably Real-ESRGAN:
         | https://github.com/xinntao/Real-ESRGAN
        
       | nadermx wrote:
       | Author of project here. Waking up and seeing my project on the
       | front of HN blew me away, thank you everyone. I will go ahead and
       | update the about us on the page on the website.
        
         | Fire-Dragon-DoL wrote:
         | Wow! I just tested with a complex image and it did a great job.
         | I remember when we had to do this by hand. Thank you!
        
         | Daub wrote:
         | FYI... the golden value in FG.BG separation is the single pixel
         | bleed between the two. Unless the new background is of the same
         | value as the old, then this would show up as a light or a dark
         | fringe. At erode filter can remove this in hard-edged objects,
         | but an erode would destroy fuzzy objects like hair. This is why
         | compositors often separate soft and hard selections.
        
         | sebastiennight wrote:
         | This project looks promising! Your pricing is also attractive,
         | at about half of Unscreen's API. Plus you're open source which
         | is another bonus point.
         | 
         | However, your pricing structure is confusing to me: what does
         | "commercial license for 10" mean when pricing for developers?
         | If we want to integrate your tool in an app, then we would need
         | to have commercial licenses for all generated content, in order
         | to pass that on to the end user. Can you clarify that point?
         | 
         | Also, your outputs all seem to have all-white backgrounds.
         | Would it be possible to specify an image or hex color code that
         | would be used as the new background?
        
           | nadermx wrote:
           | Thanks for pointing out how confusing the pricing page was
           | for developers. I went ahead and fixed that. In regards to
           | the background color, it should come out clear. Depending on
           | your viewer I guess it's white. I can put those features on
           | the road map. Have something similar for videos already, so I
           | presume you mean images.
        
         | Daub wrote:
         | I am a painter who has collaborated with computer vision
         | engineers on style transfer between paintings (aesthetic
         | exemplars) and photographs. One of the things that
         | distinguishes a painter from a camera operator is their depth
         | aware organisation of colour contrasts. I use plural as there
         | are many forms of colour contrast. I believe that effective
         | Foreground-background separation has greatly underestimated
         | potential to impact the future of the photographically acquired
         | image. More power to you sir.
        
       | logicallee wrote:
       | Works awesome!!! I went to the web site it powers:
       | 
       | https://BackgroundRemoverAI.com
       | 
       | Uploaded this photo:
       | 
       | https://ibb.co/9bv0662
       | 
       | Selected the option to remove all background elements and nearly
       | instantly got this result:
       | 
       | https://ibb.co/WfFsbqW
       | 
       | While, arguably, the legs are part of Zuckerberg, it is an
       | unusual pose and instead the AI picked the subject in a way that
       | is totally suited for inclusion against another background (for
       | example a montage of various founders). The outline it chose
       | looks great.
       | 
       | It's a pleasing result that shows the power of AI.
        
         | rikroots wrote:
         | I was going to say that I like the MediaPipe Selfie
         | Segmentation model for doing this sort of thing in a web page,
         | but I've just noticed (when getting the GitHub link[1]) that
         | Google have marked the code as legacy[2] ... no idea if the new
         | solution is better/easier to use[3].
         | 
         | For what it's worth, my CodePen using the old model is here:
         | https://codepen.io/kaliedarik/pen/PopBxBM
         | 
         | [1] -
         | https://github.com/google/mediapipe/blob/master/docs/solutio...
         | 
         | [2] - "Attention: Thank you for your interest in MediaPipe
         | Solutions. As of April 4, 2023, this solution was upgraded to a
         | new MediaPipe Solution."
         | 
         | [3] -
         | https://developers.google.com/mediapipe/solutions/vision/ima...
        
           | nwoli wrote:
           | Mediapipe is such a mess (but so useful). I wish someone
           | would just extract the main tflite models and make a light
           | wrapper around it on GitHub somewhere
        
       | yashg wrote:
       | This is good. Remove.bg is pretty much the gold standard of
       | background removal services due to it's nearly flawless detection
       | of lines separating foreground from the background. But it is a
       | paid service, there are other 2 free services that I have used
       | occasionally when I have needed to remove background which allow
       | download of full sized image after removing the background.
       | 
       | https://www.inpixio.com/remove-background/
       | 
       | https://express.adobe.com/tools/remove-background
       | 
       | Adobe is by the best for free services which allows downloading
       | full size transparent image. I compared your tool with the other
       | 3. The results can be seen at https://i.imgur.com/RQT28yp.jpg
       | 
       | I will download this and try to build myself. Thanks for making
       | it open source.
        
         | rgbrgb wrote:
         | Are you trying to just cut out the person with those? Looks
         | like adobe and remove.bg do the best on getting a good
         | selection (edges) but OP's tool does best on selecting just the
         | person.
        
           | yashg wrote:
           | I am just comparing default output from each tool. OP's tool
           | asks for what object to detect and keep, I had selected human
           | so I guess that's why it only kept the person. But yes, my
           | intention was to keep just the person. For this photo, I
           | would go with Adobe because OP's tool adds a halo like
           | outline all around the person. It would differ from photo to
           | photo I think.
        
             | rgbrgb wrote:
             | Makes sense, and agreed, adobe's has the best cutout and
             | the plant "artifact" is much easier to get rid of than the
             | halo.
        
       | weird_user wrote:
       | Fun fact: The demo image is an example of the hand-in-waistcoat
       | gesture[1].
       | 
       | [1] https://en.wikipedia.org/wiki/Hand-in-waistcoat
        
         | tough wrote:
         | You mean the astronaut shot?
        
       | Pxtl wrote:
       | How fast is this? I know I've always craved a "ai-based Magic
       | Wand selector" for GIMP.
        
       | wruza wrote:
       | Anyone knows how it compares to rembg in speed/quality?
        
       | zerr wrote:
       | How do you train such models? Where do you get the training
       | dataset?
        
       | gumballindie wrote:
       | We need a gimp like app with all these integrated.
        
       | vladstudio wrote:
       | I do realize it's not the same at all, but Pixelmator for Mac is
       | a great little image editor that has "Remove background" and more
       | AI-powered features, such as smart up-scaling.
       | 
       | https://www.pixelmator.com/
        
         | bookofjoe wrote:
         | In the latest MacOS I noticed "Remove Background" as an option
         | when editing photos in Photos app. It's like magic. AI for
         | everyone.
        
           | dagmx wrote:
           | it's in many places on macOS and iOS.
           | 
           | The Lock Screen on iOS , safari, photos, keynote, shortcuts
           | etc...
           | 
           | I don't think there's API access though which would be really
           | handy.
        
             | newjersey wrote:
             | I think this only applies to photos with depth information,
             | right?
        
               | lazycouchpotato wrote:
               | Nope. Works with any image in the Photos app.
               | 
               | I don't remember the steps, but its either in a menu or
               | you can press and hold the foreground object to make a
               | "cut out" of it and paste it in a different app.
               | https://youtu.be/qX82kIaRNKA?t=15
        
               | bookofjoe wrote:
               | That's above my TechnoDolt(c)(r) pay grade
        
               | ace2358 wrote:
               | Nope. This works on any old picture you can view. Just as
               | the text highlight in a picture is also os wide. Just
               | background AI processing. It's very neato
        
         | lawik wrote:
         | Well both seem to use u2net for removing backgrounds so almost
         | literally the same thing.
        
       ___________________________________________________________________
       (page generated 2023-05-06 23:01 UTC)