Instructions to use AndreCosta/resnet-unet-segmentation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AndreCosta/resnet-unet-segmentation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="AndreCosta/resnet-unet-segmentation")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AndreCosta/resnet-unet-segmentation", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download scripts/Dataset/grays.py from AndreCosta/resnet-unet-segmentation: direct link, hf CLI and curl.
- Browser
- Download file 665 Bytes
-
https://huggingface.co/AndreCosta/resnet-unet-segmentation/resolve/main/scripts/Dataset/grays.py
- Command line
-
hf download hf://AndreCosta/resnet-unet-segmentation/scripts/Dataset/grays.py
-
curl -L -o grays.py https://huggingface.co/AndreCosta/resnet-unet-segmentation/resolve/main/scripts/Dataset/grays.py
665 Bytes
| #encoding=utf8 | |
| import os | |
| from PIL import Image | |
| import scripts.config as config | |
| def convert_all(target, extensao): | |
| paths = [os.path.join(target, nome) for nome in os.listdir(target)] | |
| files = [arq for arq in paths if os.path.isfile(arq)] | |
| arquivos = [arq for arq in files if arq.lower().endswith(extensao)] | |
| for img in arquivos: | |
| pathImage = str(img) | |
| print(' ' + pathImage) | |
| image = Image.open(pathImage) | |
| image = image.convert("L") | |
| image.save(pathImage) | |
| print('Starting processing...') | |
| convert_all(config.images, '.jpg') | |
| convert_all(config.masks, '.png') | |
| print('\n\nCompleted...') | |