Since you work for retail client especially products on shelves images in order to moderate the images use Computer Vision and Content Safety service.
The Product Recognition APIs let you analyze photos of shelves in a retail store. You can detect the presence of products and get their bounding box coordinates. Use it in combination with model customization to train a model to identify your specific products.
Please find detailed documentation for computer vision product on shelves
https://learn.microsoft.com/en-us/azure/ai-services/computer-vision/concept-shelf-analysis
In order to moderate the content on images use detailed documentation
https://learn.microsoft.com/en-us/azure/ai-services/content-safety/overview
Please find sample python code to moderate the image content on the product on the shelves.
def analyze_image():
# [START analyze_image]
import os
from azure.ai.contentsafety import ContentSafetyClient
from azure.core.credentials import AzureKeyCredential
from azure.core.exceptions import HttpResponseError
from azure.ai.contentsafety.models import AnalyzeImageOptions, ImageData
key = os.environ["CONTENT_SAFETY_KEY"]
endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]
image_path = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "./sample_data/image.jpg"))
# Create an Content Safety client
client = ContentSafetyClient(endpoint, AzureKeyCredential(key))
# Build request
with open(image_path, "rb") as file:
request = AnalyzeImageOptions(image=ImageData(content=file.read()))
# Analyze image
try:
response = client.analyze_image(request)
except HttpResponseError as e:
print("Analyze image failed.")
if e.error:
print(f"Error code: {e.error.code}")
print(f"Error message: {e.error.message}")
raise
print(e)
raise
if response.hate_result:
print(f"Hate severity: {response.hate_result.severity}")
if response.self_harm_result:
print(f"SelfHarm severity: {response.self_harm_result.severity}")
if response.sexual_result:
print(f"Sexual severity: {response.sexual_result.severity}")
if response.violence_result:
print(f"Violence severity: {response.violence_result.severity}")
# [END analyze_image]
if __name__ == "__main__":
analyze_image()
Please try out these steps with your data and check if it works. Hope this answer helps you with solution! Please comment below if you need any assistance on the same. Happy to help!
Regards,
Janarthanan S