Slide 76
Slide 76 text
# import library
import torch
from carvekit.api.high import HiInterface
# create CarveKit interface
interface = HiInterface(batch_size_seg=5, batch_size_matting=1,
device='cuda' if torch.cuda.is_available() else 'cpu',
seg_mask_size=320, matting_mask_size=2048)
images_without_background = interface([img_name])
# save object only image
cat_wo_bg = images_without_background[0]
cat_wo_bg.save(‘object_only.png')
PythonͰΠϥετ͔Β৭ͷํΛ୳Δ
ඃࣸମͱഎܠͷؔΛ୳Δɿରൺ͔ಉԽ͔ʢ$BSWF,JUͰʣ
ඃࣸମͱഎܠͷɺڊਓͷݞʢ4FHNFOUBUJPOʣ͕ࢁɻࠓճ$BSWF,JUͱ͍͏'8Λར༻ͨ͠ɻ