Code Monkey home page Code Monkey logo

image-background-remover-python's Introduction

Image Background Remover Python Script With U2Net

Remove Backgrounds From Images with u2net Trained model

I was surfing the internet searching for AI tools, and I stumbled upon an Image Background Remover service called Remove.Bg. But I was shocked with the pricing. 0.2$ / Image!

So I decided to take the challenge and build my own Image Background Remover without relying on any APIs or Third Parties.

After Searching for a couple of days, I found a great python project on GitHub, Called U2Net.

A Big Shootout and Thanks to the authors of this project!

I trued my best to make things as simple as possible, so even newbies, can use and run the python script I built.

I created a Short Video Showing The Script & How to use it, and I pointed to two special secrets that may help you build an online income stream with the help of this script. here is the video: https://youtu.be/KkhPN7Z4Fy8

Download The Project Source Code With Trainined Model Here: https://learnwithhasan.com/remove-image-background-with-python/

Thank You!

image-background-remover-python's People

Contributors

hassancs91 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

image-background-remover-python's Issues

RuntimeError

Traceback (most recent call last):
File "/home/suhan/DLPro/Image-Background-Remover-Python-main/init.py", line 113, in
print(removeBg(imgPath))
File "/home/suhan/DLPro/Image-Background-Remover-Python-main/init.py", line 82, in removeBg
d1, d2, d3, d4, d5, d6, d7 = net(image)

RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same or input should be a MKLDNN tensor and weight is a dense tensor

Hi , I have install all the necessary packages and i use interpreter as conda. I Got the above error. I can't able to solve. Please, can you help me to solve this.Thanks in advance.

File not found u2net.pth

Hi, I finally got this python project to start loading models.
Realizing that python must be a 64bit version in order to install torch, and many other trial and error. :)

However, now I'm getting a runtime error because I apparently don't have a model u2net.pth.

Traceback (most recent call last): File "C:\Users\Benjamin\AppData\Local\Programs\Python\Python38\Image-Background-Remover-Python-main\__init__.py", line 106, in <module> net.load_state_dict(torch.load(model_dir, map_location='cpu')) File "C:\Users\Benjamin\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\serialization.py", line 594, in load with _open_file_like(f, 'rb') as opened_file: File "C:\Users\Benjamin\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "C:\Users\Benjamin\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\serialization.py", line 211, in __init__ super(_open_file, self).__init__(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Benjamin\\AppData\\Local\\Programs\\Python\\Python38\\Image-Background-Remover-Python-main\\saved_models\\u2net\\u2net.pth'

How do I build this model?

Many thanks!

Issue : While Loading Modal in Line no 106

Hey can You please help me out doing this setup as I m facing issues setting it up because of modal // It fails loading the modal as the path which is mentioned there (.pth) is not present in saved modals section so pls help me out

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.