# AWS outlines per-camera visual inspection lifecycle with SageMaker SDK v3

- Source: MechNext — https://mechnext.eu/ru/article/54-aws-outlines-per-camera-visual-inspection-lifecycle-with-sagemaker-sdk-v3
- Published: 2026-10-27
- Updated: 2026-10-27
- Category: Industry News
- Language: ru (Markdown in other languages: ?lang=en, ?lang=de, ?lang=sk, ?lang=pl, ?lang=zh)

> An AWS reference architecture combines per-camera training, ONNX quality gates and Neo compilation, with retraining concurrency controls and explicit limits on what the sample deploys.

AWS presents a SageMaker Python SDK v3 reference architecture for visual inspection that updates a pipeline pattern from 2023. It replaces deprecated SageMaker Edge Manager with SageMaker Neo for edge optimization and deploys the infrastructure through AWS CDK. The article describes a sample architecture and its reported results, rather than independently verified production-fleet performance.

### One pipeline, camera-specific models

The sample uses one camera-parameterized SageMaker Pipeline with 13 steps. It preprocesses images, retrieves the requesting camera's latest approved models and trains two branches: a convolutional autoencoder for anomaly detection and a fine-tuned ResNet18 defect classifier. The classifier starts with ImageNet-pretrained weights and a two-class head. An inverse-frequency WeightedRandomSampler balances training batches, while the loss remains unweighted.

Each branch uses a shared model package group. Packages carry camera IDs and evaluation metrics. Because ListModelPackages cannot filter customer metadata on the server, retrieval scans approved packages newest-first to find the relevant camera. On a first run, the classifier uses ImageNet weights and the autoencoder starts from random initialization. Later runs resume from that camera's previous model.

### Quality gates precede compilation

Evaluation runs on exported ONNX artifacts. The anomaly branch needs an AUROC of at least 0.8. The classifier must achieve both balanced accuracy of at least 0.6 and defect recall of at least 0.5. These thresholds are adjustable for each execution. A failed branch does not register its model, while the other branch can still register independently. The camera continues serving its previous approved model.

Both branches follow the same sequence: quality gate, Neo compilation, then registration. Compilation repackages the export into an ONNX-only tarball and pins batch size to 1. Its job name derives from the pipeline execution ID, allowing retries to resume polling the existing compilation job.

Neo targets are pipeline parameters. LINUX/X86_64 is the default platform, with named-device options including jetson_xavier and rasp4b. The compiled package contains compiled.so and the DLR runtime. A repository script also compiles registered models for additional device types without retraining.

The Model Registry catalogs portable ONNX artifacts; S3 holds the Neo-compiled builds loaded by DLR. Registry entries reference the training image and support downstream artifact delivery to devices, rather than CreateEndpoint deployment. The sample itself does not implement device artifact delivery or inference endpoints. This distinction separates model preparation and cataloging from the subsequent delivery step.

### Retraining requests and SDK migration

Retraining requests enter an SQS FIFO queue, and Lambda starts a Step Functions execution for each request. A DynamoDB semaphore atomically limits concurrent pipeline executions to five by default. Executions wait and retry when capacity is full, and slots are released on completion and failure paths. SNS reports completions and operational failures, with failures forwarded through EventBridge.

SDK v3 splits functionality into modular packages and places training configuration in typed objects passed to ModelTrainer. In this CDK sample, live IAM role validation during synthesis requires deployment in two phases and a concrete role ARN. AWS also reports that the v3 validator's ECR permission simulation requires a broader ECR grant than a runtime policy restricted to one repository.

### What the sample's measurements cover

Synthetic production-line images are generated by default. AWS reports that a full 13-step run, including both Neo compilations, takes about 15 minutes and costs roughly $0.07 in billed ml.m5.xlarge time, using July 2026 on-demand prices in US East (Ohio). Reported orchestration costs are well under $0.10 per month at sample scale. Neo compilation itself has no charge, while processing and S3 storage incur costs. These figures do not establish costs or runtime for production fleets, other Regions, hardware or pricing dates.

The repository also includes a downloader for 364 annotated BCCD blood-smear images. It maps platelet presence to the defect class, can divide images by camera and uploads training tarballs. An accompanying notebook runs the pipeline and compares ONNX inference on normal and anomalous samples. The article explicitly treats the platelet mapping as a manufacturing illustration, not a clinical claim.
