mta122
first
ca4133a
raw history blame
No virus
645 Bytes
# pip install rembg[gpu]
# read details on https://github.com/brilam/remove-bg
# Paper: U2-Net: Going deeper with nested U-structure for salient object detection
import os
#chess, c
#surfing, s
objects = "PLANT"
letter = "L"
for mode in ["one","all"]:
path_in = f"/localhome/mta122/PycharmProjects/logo_ai/final_nocherry_score/{mode}/{objects}/{letter}"
for fpath_file in os.listdir(path_in):
# fpath = 'data/parrot_2.png'
fpath = os.path.join(path_in, fpath_file)
fpath_out = fpath.split('.')[0] + '_result_rembg.png'
cmd = f'rembg i {fpath} {fpath_out}'
print(cmd)
os.system(cmd)