Skip to content

Commit dbf20bd

Browse files
authored
Update README.md
1 parent 2675bcb commit dbf20bd

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Image | Video | Webcam
1717
:-:|:-:|:-:
1818
<img src=https://raw.githubusercontent.com/plemeri/transparent-background/main/figures/demo_aeroplane.gif height=200px> | <img src=https://raw.githubusercontent.com/plemeri/transparent-background/main/figures/demo_b5.gif height=200px> | <img src=https://raw.githubusercontent.com/plemeri/transparent-background/main/figures/demo_webcam.gif height=200px>
1919

20+
## :rotating_light: Notice
21+
* `--jit` option, also known as TorchScript option is widely used recently for disabling dynamic resizing for stable output. Since it wasn't mean to be used in this way, I added `--format` option. For those who used `--jit` option because of the stability, you don't have to specify anymore.
22+
2023
## :newspaper: News
2124

2225
* Our package is currently not working properly on small images without `--fast` argument. Sorry for the inconvenience and we'll fix this issue with better algorithm coming out shortly.
@@ -27,7 +30,8 @@ Image | Video | Webcam
2730
* [2024.08.22] [ComfyUI-Inspyrenet-Rembg](https://github.com/john-mnz/ComfyUI-Inspyrenet-Rembg) is implemented by [john-mnz](https://github.com/john-mnz). Thank you for sharing great work!
2831
* [2024.09.06] `transparent-background` total download counts reached 500,000 and ranked 5969 on [🏆top=pypi-package](https://hugovk.github.io/top-pypi-packages/). Thank you all for your huge support!
2932
<img src=https://github.com/user-attachments/assets/5252be1c-338c-4340-a6a5-5c421a1bf550 width=400px>
30-
* [2024.10.05] `--format`, `--resize` and `--reverse` options are implemented.
33+
34+
* [2024.10.05] `--format`, `--resize` and `--reverse` options are implemented. See Command Line and Usage sections for more details.
3135

3236

3337
## :inbox_tray: Installation
@@ -164,7 +168,7 @@ You can use gui with following command after installation.
164168
```bash
165169
transparent-background-gui
166170
```
167-
![image](https://github.com/plemeri/transparent-background/assets/40786892/eac55d75-eea7-438b-bb5c-dd05552a736a)
171+
![Screenshot 2024-10-05 194115](https://github.com/user-attachments/assets/50aaa2e1-b6f3-4dda-8e05-06f13456212a)
168172

169173
### :computer: Command Line
170174

@@ -192,9 +196,9 @@ $ transparent-background --source [SOURCE] --dest [DEST] --threshold [THRESHOLD]
192196
* Another image file (e.g., `samples/backgroud.png`) will be used as a background, and the object will be overlapped on it.
193197
* `--ckpt [CKPT]` (optional): Use other checkpoint file. Default is trained with composite dataset and will be automatically downloaded if not available. Please refer to [Model Zoo](https://github.com/plemeri/InSPyReNet/blob/main/docs/model_zoo.md) from [InSPyReNet](https://github.com/plemeri/InSPyReNet) for available pre-trained checkpoints.
194198
* `--mode [MODE]` (optional): Choose from `base`, `base-nightly` and `fast` mode. Use `base-nightly` for nightly release checkpoint.
195-
* `--resize [RESIZE]` (optional): Choose between `static` and `dynamic`. Dynamic will produce better results in terms of sharper edges but maybe unstable. Default is `static`
196-
* `--format [FORMAT]` (optional): Specify output format. If not specified, the output format will be identical to the input format.
197-
* `--reverse` (optional): Reversing result. In other words, foreground will be removed instead of background. This will make our package's name `transparent-foreground`! :laughing:
199+
* :star: `--resize [RESIZE]` (optional): Choose between `static` and `dynamic`. Dynamic will produce better results in terms of sharper edges but maybe unstable. Default is `static`
200+
* :star: `--format [FORMAT]` (optional): Specify output format. If not specified, the output format will be identical to the input format.
201+
* :star: `--reverse` (optional): Reversing result. In other words, foreground will be removed instead of background. This will make our package's name `transparent-foreground`! :laughing:
198202
* `--jit` (optional): Torchscript mode. If specified, it will trace model with pytorch built-in torchscript JIT compiler. May cause delay in initialization, but reduces inference time and gpu memory usage.
199203

200204
### :crystal_ball: Python API
@@ -210,6 +214,7 @@ from transparent_background import Remover
210214
remover = Remover() # default setting
211215
remover = Remover(mode='fast', jit=True, device='cuda:0', ckpt='~/latest.pth') # custom setting
212216
remover = Remover(mode='base-nightly') # nightly release checkpoint
217+
remover = Remover(resize='dynamic') # use dynamic resizing instead of static resizing
213218

214219
# Usage for image
215220
img = Image.open('samples/aeroplane.jpg').convert('RGB') # read image
@@ -225,8 +230,10 @@ out = remover.process(img, type='overlay') # overlay object map onto the image
225230
out = remover.process(img, type='samples/background.jpg') # use another image as a background
226231

227232
out = remover.process(img, threshold=0.5) # use threhold parameter for hard prediction.
233+
out = remover.process(img, reverse=True) # reverse output. background -> foreground
228234

229235
out.save('output.png') # save result
236+
out.save('output.jpg') # save as jpg
230237

231238
# Usage for video
232239
cap = cv2.VideoCapture('samples/b5.mp4') # video reader for input

0 commit comments

Comments
 (0)