rembg icon indicating copy to clipboard operation
rembg copied to clipboard

How to use the API interface of rembg gpu version?

Open ZzMLvzZ-792998470 opened this issue 4 months ago • 0 comments

I tried using the GPU version of Rembg for video capture processing. I called the API according to the documentation:

while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
mask = rembg.remove(frame_rgb)
#Convert the cutout result into an image with an alpha channel
outFrame = cv2.cvtColor(mask,  cv2.COLOR_RGBA2BGRA)
frame_count += 1
frame_name = f'{temp_frame_dir}/frame_{frame_count:04d}.png'
total_elapse = datetime.datetime.now() - handle_startTime
print(f"handle frameNums:{frame_count}, total_elapse:{total_elapse}")
cv2.imwrite(frame_name, outFrame)
cap.release()

But there is no fluctuation in my GPU memory. How can I modify it to correctly use the GPU version interface?

ZzMLvzZ-792998470 avatar Oct 17 '24 09:10 ZzMLvzZ-792998470