nadermx / backgroundremover

Background Remover lets you Remove Background from images and video using AI with a simple command line interface that is free and open source.
https://www.backgroundremoverai.com
MIT License
6.45k stars 535 forks source link

Alpha matting issue #78

Closed LLdotcom closed 1 year ago

LLdotcom commented 1 year ago

The command: backgroundremover -i "cute-ferret-is-sleeping.jpg" -o "test.png" works fine.

But if I try turning on alpha matting with the command: backgroundremover -i "cute-ferret-is-sleeping.jpg" -a -ae 15 -o "test.png" it fails.

I installed via pipx rather than pip, but I also tested in a virtual box (Ubuntu and Manjaro) using pip getting the same error as below:

Traceback (most recent call last): File "/home/sde/.local/bin/backgroundremover", line 8, in sys.exit(main()) File "/home/sde/.local/pipx/venvs/backgroundremover/lib/python3.10/site-packages/backgroundremover/cmd/cli.py", line 239, in main remove( File "/home/sde/.local/pipx/venvs/backgroundremover/lib/python3.10/site-packages/backgroundremover/bg.py", line 188, in remove cutout = alpha_matting_cutout( File "/home/sde/.local/pipx/venvs/backgroundremover/lib/python3.10/site-packages/backgroundremover/bg.py", line 131, in alpha_matting_cutout structure = np.ones((erode_structure_size, erode_structure_size), dtype=np.int) File "/home/sde/.local/pipx/venvs/backgroundremover/lib/python3.10/site-packages/numpy/init.py", line 305, in getattr raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'int'. np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'inf'?

mingeee commented 1 year ago

You should be able to change the np.int to np.int64

image

That should do the work.

LLdotcom commented 1 year ago

Thanks, changing np.int to np.int64 fixed it.

nadermx commented 1 year ago

If anyone wants to make a pr for this..

El mié, 24 de may de 2023 14:30, LLdotcom @.***> escribió:

Thanks, changing np.int to np.int64 fixed it.

— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/78#issuecomment-1561886375, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXAMC2UQWI55T3KKN63XHZVURANCNFSM6AAAAAAYKS4ZXA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mingeee commented 1 year ago

If anyone wants to make a pr for this.. El mié, 24 de may de 2023 14:30, LLdotcom @.> escribió: Thanks, changing np.int to np.int64 fixed it. — Reply to this email directly, view it on GitHub <#78 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXAMC2UQWI55T3KKN63XHZVURANCNFSM6AAAAAAYKS4ZXA . You are receiving this because you are subscribed to this thread.Message ID: @.>

I have make a pr for this: https://github.com/nadermx/backgroundremover/pull/79

nadermx commented 1 year ago

Closed in https://github.com/nadermx/backgroundremover/commit/e29385e2275390dfcf52271e9d0b7343df4bcc4d