Instructions to use Nekshay/Finetuned-MobilVIT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nekshay/Finetuned-MobilVIT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="Nekshay/Finetuned-MobilVIT") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("Nekshay/Finetuned-MobilVIT") model = AutoModelForImageClassification.from_pretrained("Nekshay/Finetuned-MobilVIT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| import cv2 | |
| import numpy as np | |
| # Load the image (assuming it's a binary image with edges) | |
| image = cv2.imread('path/to/edge_detected_image.jpg', cv2.IMREAD_GRAYSCALE) | |
| # Apply morphological operations to clean up the edges | |
| kernel = np.ones((5, 5), np.uint8) | |
| closed_image = cv2.morphologyEx(image, cv2.MORPH_CLOSE, kernel) | |
| # Find contours in the closed image | |
| contours, _ = cv2.findContours(closed_image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) | |
| # Create a mask for the exterior contours | |
| mask = np.zeros_like(image) | |
| cv2.drawContours(mask, contours, -1, (255), thickness=cv2.FILLED) | |
| # Apply the mask to the original image to get only the exterior edges | |
| exterior_edges = cv2.bitwise_and(image, mask) | |
| # Display the result or save it to a file | |
| cv2.imshow('Exterior Edges', exterior_edges) | |
| cv2.waitKey(0) | |
| cv2.destroyAllWindows() | |