File size: 645 Bytes
ca4133a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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)