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/ConvertFormat.py from AndreCosta/resnet-unet-segmentation: direct link, hf CLI and curl.
- Browser
- Download file 977 Bytes
-
https://huggingface.co/AndreCosta/resnet-unet-segmentation/resolve/main/scripts/Dataset/ConvertFormat.py
- Command line
-
hf download hf://AndreCosta/resnet-unet-segmentation/scripts/Dataset/ConvertFormat.py
-
curl -L -o ConvertFormat.py https://huggingface.co/AndreCosta/resnet-unet-segmentation/resolve/main/scripts/Dataset/ConvertFormat.py
977 Bytes
| #encoding=utf8 | |
| import os | |
| from PIL import Image | |
| import scripts.config as config | |
| target = config.masks | |
| extension_destination = '.png' | |
| print('Starting processing...') | |
| files = os.listdir(target) | |
| for fileOne in files: | |
| nameFile, extension = os.path.splitext(fileOne) | |
| print('Testing: ', fileOne) | |
| if((extension != extension_destination) and | |
| (extension != '.json')): | |
| if(extension == ''): | |
| extension = '....' | |
| print('\nRenaming: ' + str(fileOne)) | |
| origem = os.path.join(target, fileOne) | |
| destino = fileOne.replace(extension, extension_destination) | |
| if(extension == '....'): | |
| destino = destino + extension_destination | |
| destino = os.path.join(target, destino) | |
| im = Image.open(origem).convert('RGB') | |
| im.save(destino, 'PNG') | |
| os.remove(origem) | |
| print('-----------------------------------------') | |
| print('\n\nCompleted...') | |