Sam K.
Hey Alex,
Regarding imbalanced datasets in Custom Vision, you can often mitigate this by oversampling the minority class (by duplicating images or using data augmentation) or undersampling the majority class. Custom Vision itself has some internal mechanisms to handle this, but it's good practice to pre-process your data.
For transfer learning, Custom Vision implicitly uses transfer learning from pre-trained models. When you create a project, you can choose a base model. Make sure to select the one that best suits your general domain (e.g., general object detection vs. specific medical imaging if available as a base). The service then fine-tunes this base model on your custom data.
Here’s a snippet of how you might use the SDK after training:
from azure.cognitiveservices.vision.customvision.prediction import CustomVisionClient
from azure.cognitiveservices.vision.customvision.prediction.models import ImageUrl
# Replace with your actual keys and endpoint
prediction_key = "YOUR_PREDICTION_KEY"
endpoint = "YOUR_ENDPOINT"
project_id = "YOUR_PROJECT_ID"
published_iteration_name = "YOUR_PUBLISHED_ITERATION_NAME"
predictor = CustomVisionClient(endpoint, prediction_key)
with open("path/to/your/image.jpg", "rb") as image_file:
results = predictor.classify_image(project_id, published_iteration_name, image_file)
for prediction in results.predictions:
print(f"{prediction.tag_name}: {prediction.probability:.2f}")