danielgatis / rembg

Rembg is a tool to remove images background
MIT License
15.46k stars 1.76k forks source link

[QUALITY] The results are different between rembg cli and rembg with new section #560

Closed truongnn1106 closed 4 months ago

truongnn1106 commented 6 months ago

Describe the bug Why are the results different between rembg cli and rembg with new session with the same u2net model?

To Reproduce Steps to reproduce the behavior:

  1. When I run with command: rembg p path/to/input path/to/output This is my result: 2_cli

  2. When I run with library:

    
    from pathlib import Path
    from rembg import remove, new_session
    session = new_session()

for file in Path('path/to/folder').glob('*.png'): input_path = str(file) output_path = str(file.parent / (file.stem + ".out.png")) with open(input_path, 'rb') as i: with open(output_path, 'wb') as o: input = i.read() output = remove(input, session=session) o.write(output)


This is my result
![2](https://github.com/danielgatis/rembg/assets/151597648/3d094695-71ec-474a-ab40-023533629c90)

**Difference two images**
![difference](https://github.com/danielgatis/rembg/assets/151597648/d21be3a0-67f3-4c01-b50f-c770e765eed7)

**Expected behavior**
After checking, I realized that two images are different. Can you help me fine-tune it to use a cli-like library?
github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 4 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.