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/deleteDuplicates.py from AndreCosta/resnet-unet-segmentation: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/AndreCosta/resnet-unet-segmentation/resolve/main/scripts/Dataset/deleteDuplicates.py
- Command line
-
hf download hf://AndreCosta/resnet-unet-segmentation/scripts/Dataset/deleteDuplicates.py
-
curl -L -o deleteDuplicates.py https://huggingface.co/AndreCosta/resnet-unet-segmentation/resolve/main/scripts/Dataset/deleteDuplicates.py
1.01 kB
| import os | |
| import imagehash | |
| from PIL import Image | |
| import scripts.config as config | |
| hashes = {} | |
| duplicates = [] | |
| paths = [os.path.join(config.images, nome) for nome in os.listdir(config.images)] | |
| files = [arq for arq in paths if os.path.isfile(arq)] | |
| fileNames = [arq for arq in files if arq.lower().endswith('.jpg')] | |
| for filename in fileNames: | |
| filepath = filename | |
| try: | |
| with Image.open(filepath) as img: | |
| img_hash = imagehash.phash(img) # Ou: dhash(img), average_hash(img) | |
| if img_hash in hashes: | |
| print(f"Duplicate detected: {filename} ≈ {hashes[img_hash]}") | |
| duplicates.append(filepath) | |
| else: | |
| hashes[img_hash] = filename | |
| except Exception as e: | |
| print(f"Error processing {filename}: {e}") | |
| for dup in duplicates: | |
| try: | |
| os.remove(dup) | |
| print(f"Removed: {dup}") | |
| except Exception as e: | |
| print(f"Error removing {dup}: {e}") | |
| print(f"\nTotal duplicates removed: {len(duplicates)}") | |