Friday, May 29, 2026
banner
Top Selling Multipurpose WP Theme

This put up is co-written Rodrigo Amaral, Ashwin Murthy and Meghan Stronach from Qualcomm.

On this put up, we introduce an progressive answer for end-to-end mannequin customization and deployment on the edge utilizing Amazon SageMaker and Qualcomm AI Hub. This seamless cloud-to-edge AI improvement expertise will allow builders to create optimized, extremely performant, and customized managed machine studying options the place you possibly can carry you personal mannequin (BYOM) and convey your individual information (BYOD) to fulfill diverse enterprise necessities throughout industries. From real-time analytics and predictive upkeep to personalised buyer experiences and autonomous methods, this method caters to numerous wants.

We show this answer by strolling you thru a complete step-by-step information on fine-tune YOLOv8, a real-time object detection mannequin, on Amazon Internet Providers (AWS) utilizing a customized dataset. The method makes use of a single ml.g5.2xlarge occasion (offering one NVIDIA A10G Tensor Core GPU) with SageMaker for fine-tuning. After fine-tuning, we present you optimize the mannequin with Qualcomm AI Hub in order that it’s prepared for deployment throughout edge gadgets powered by Snapdragon and Qualcomm platforms.

Enterprise problem

Right now, many builders use AI and machine studying (ML) fashions to deal with quite a lot of enterprise circumstances, from good identification and pure language processing (NLP) to AI assistants. Whereas open supply fashions supply start line, they typically don’t meet the precise wants of the functions being developed. That is the place mannequin customization turns into important, permitting builders to tailor fashions to their distinctive necessities and guarantee optimum efficiency for particular use circumstances.

As well as, on-device AI deployment is a game-changer for builders crafting use circumstances that demand immediacy, privateness, and reliability. By processing information domestically, edge AI minimizes latency, ensures delicate info stays on-device, and ensures performance even in poor connectivity. Builders are subsequently in search of an end-to-end answer the place they cannot solely customise the mannequin but additionally optimize the mannequin to focus on on-device deployment. This permits them to supply responsive, safe, and sturdy AI functions, delivering distinctive person experiences.

How can Amazon SageMaker and Qualcomm AI Hub assist?

BYOM and BYOD supply thrilling alternatives so that you can customise the mannequin of your alternative, use your individual dataset, and deploy it in your goal edge system. By means of this answer, we suggest utilizing SageMaker for mannequin fine-tuning and Qualcomm AI Hub for edge deployments, making a complete end-to-end mannequin deployment pipeline. This opens new prospects for mannequin customization and deployment, enabling builders to tailor their AI options to particular use circumstances and datasets.

SageMaker is a wonderful alternative for mannequin coaching, as a result of it reduces the time and value to coach and tune ML fashions at scale with out the necessity to handle infrastructure. You possibly can benefit from the highest-performing ML compute infrastructure at the moment accessible, and SageMaker can scale infrastructure from one to hundreds of GPUs. Since you pay just for what you employ, you possibly can handle your coaching prices extra successfully. SageMaker distributed coaching libraries can mechanically break up massive fashions and coaching datasets throughout AWS GPU situations, or you should utilize third-party libraries, comparable to DeepSpeed, Horovod, Totally Sharded Information Parallel (FSDP), or Megatron. You possibly can prepare basis fashions (FMs) for weeks and months with out disruption by mechanically monitoring and repairing coaching clusters.

After the mannequin is skilled, you should utilize Qualcomm AI Hub to optimize, validate, and deploy these personalized fashions on hosted gadgets with Snapdragon and Qualcomm Applied sciences inside minutes. Qualcomm AI Hub is a developer-centric platform designed to streamline on-device AI improvement and deployment. AI Hub gives computerized conversion and optimization of PyTorch or ONNX fashions for environment friendly on-device deployment utilizing TensorFlow Lite, ONNX Runtime, or Qualcomm AI Engine Direct SDK. It additionally has an current library of over 100 pre-optimized fashions for Qualcomm and Snapdragon platforms.

Qualcomm AI Hub has served greater than 800 firms and continues to increase its choices when it comes to fashions accessible, platforms supported, and extra.

Utilizing SageMaker and Qualcomm AI Hub collectively can create new alternatives for fast iteration on mannequin customization, offering entry to highly effective improvement instruments and enabling a clean workflow from cloud coaching to on-device deployment.

Answer structure

The next diagram illustrates the answer structure. Builders working of their native atmosphere provoke the next steps:

  1. Choose an open supply mannequin and a dataset for mannequin customization from the Hugging Face repository.
  2. Pre-process the info into the format required by your mannequin for coaching, then add the processed information to Amazon Easy Storage Service (Amazon S3). Amazon S3 supplies a extremely scalable, sturdy, and safe object storage answer in your machine studying use case.
  3. Name the SageMaker management aircraft API utilizing the SageMaker Python SDK for mannequin coaching. In response, SageMaker provisions a resilient distributed coaching cluster with the requested quantity and kind of compute situations to run the mannequin coaching. SageMaker additionally handles orchestration and screens the infrastructure for any faults.
  4. After the coaching is full, SageMaker spins down the cluster, and also you’re billed for the web coaching time in seconds. The ultimate mannequin artifact is saved to an S3 bucket.
  5. Pull the fine-tuned mannequin artifact from Amazon S3 to the native improvement atmosphere and validate the mannequin accuracy.
  6. Use Qualcomm AI Hub to compile and profile the mannequin, working it on cloud-hosted gadgets to ship efficiency metrics forward of downloading for deployment throughout edge gadgets.

Use case stroll by way of

Think about a number one electronics producer aiming to boost its high quality management course of for printed circuit boards (PCBs) by implementing an automatic visible inspection system. Initially, utilizing an open supply imaginative and prescient mannequin, the producer collects and annotates a big dataset of PCB pictures, together with each faulty and non-defective samples.

This dataset, just like the keremberke/pcb-defect-segmentation dataset from HuggingFace, accommodates annotations for widespread defect lessons comparable to dry joints, incorrect installations, PCB harm, and quick circuits. With SageMaker, the producer trains a customized YOLOv8 mannequin (You Solely Look As soon as), developed by Ultralytics, to acknowledge these particular PCB defects. The mannequin is then optimized for deployment on the edge utilizing Qualcomm AI Hub, offering environment friendly efficiency on chosen platforms comparable to industrial cameras or handheld gadgets used within the manufacturing line.

This personalized mannequin considerably improves the standard management course of by precisely detecting PCB defects in real-time. It reduces the necessity for handbook inspections and minimizes the chance of faulty PCBs progressing by way of the manufacturing course of. This results in improved product high quality, elevated effectivity, and substantial price financial savings.

Let’s stroll by way of this state of affairs with an implementation instance.

Conditions

For this walkthrough, you must have the next:

  1. Jupyter Pocket book – The instance has been examined in Visible Studio Code with Jupyter Pocket book utilizing the Python 3.11.7 atmosphere.
  2. An AWS account.
  3. Create an AWS Id and Entry Administration (IAM) person with the AmazonSageMakerFullAccess coverage to allow you to run SageMaker APIs. Arrange your safety credentials for CLI.
  4. Set up AWS Command Line Interface (AWS CLI) and use aws configure to arrange your IAM credentials securely.
  5. Create a job with the title sagemakerrole to be assumed by SageMaker. Add managed insurance policies AmazonS3FullAccess to provide SageMaker entry to your S3 buckets.
  6. Ensure your account has the SageMaker Coaching useful resource kind restrict for ml.g5.2xlarge elevated to 1 utilizing the Service Quotas console.
  7. Observe the get started instructions to put in the mandatory Qualcomm AI Hub library and arrange your distinctive API token for Qualcomm AI Hub.
  8. Use the next command to clone the GitHub repository with the property for this use case. This repository consists of a pocket book that references coaching property.
    $ git clone https://github.com/aws-samples/sm-qai-hub-examples.git
    $ cd sm-qai-hub-examples/yolo

The sm-qai-hub-examples/yolo  listing accommodates all of the coaching scripts that you just may must deploy this pattern.

Subsequent, you’ll run the sagemaker_qai_hub_finetuning.ipynb pocket book to fine-tune the YOLOv8 mannequin on SageMaker and deploy it on the sting utilizing AI Hub. See the pocket book for extra particulars on every step. Within the following sections, we stroll you thru the important thing parts of fine-tuning the mannequin.

Step 1: Entry the mannequin and information

  1. Start by putting in the mandatory packages in your Python atmosphere. On the prime of the pocket book, embrace the next code snippet, which makes use of Python’s pip bundle supervisor to put in the required packages in your native runtime atmosphere.
    %pip set up -Uq sagemaker==2.232.0 ultralytics==8.2.100 datasets==2.18.0

  2. Import the mandatory libraries for the venture. Particularly, import the Dataset class from the Hugging Face datasets library and the YOLO class from the ultralytics library. These libraries are essential in your work, as a result of they supply the instruments you want to entry and manipulate the dataset and work with the YOLO object detection mannequin.
    from datasets import Dataset
    
    from ultralytics import YOLO

Step 2: Pre-process and add information to S3

To fine-tune your YOLOv8 mannequin for detecting PCB defects, you’ll use the keremberke/pcb-defect-segmentation dataset from Hugging Face. This dataset consists of 189 pictures of chip defects (prepare: 128 pictures, validation: 25 pictures and take a look at: 36 pictures). These defects are annotated in COCO format.

YOLOv8 doesn’t acknowledge these lessons out of the field, so you’ll map YOLOv8’s logits to determine these lessons throughout mannequin fine-tuning, as proven within the following picture.

  1. Start by downloading the dataset from Hugging Face to the native disk and changing it to the required YOLO dataset construction utilizing the utility operate CreateYoloHFDataset. This construction ensures that the YOLO API accurately masses and processes the photographs and labels throughout the coaching section.
    dataset_name = "keremberke/pcb-defect-segmentation"
    dataset_labels = [
        'dry_joint', 
        'incorrect_installation', 
        'pcb_damage', 
        'short_circuit'
    ]
    
    information = CreateYoloHFDataset(
        hf_dataset_name=dataset_name, 
        labels_names=dataset_labels
    )

  2. Add the dataset to Amazon S3. This step is essential as a result of the dataset saved in S3 will function the enter information channel for the SageMaker coaching job. SageMaker will effectively handle the method of distributing this information throughout the coaching cluster, permitting every node to entry the mandatory info for mannequin coaching.
    uploaded_s3_uri = sagemaker.s3.S3Uploader.add(
        local_path=data_path, 
        desired_s3_uri=f"s3://{s3_bucket}/qualcomm-aihub...”
    )

Alternatively, you should utilize your individual customized dataset (non-Hugging Face) to fine-tune the YOLOv8 mannequin, so long as the dataset complies with the YOLOv8 dataset format.

Step 3: High quality-tune your YOLOv8 mannequin

3.1: Assessment the coaching script

You’re now ready to fine-tune the mannequin utilizing the mannequin.prepare methodology from the Ultralytics YOLO library.

We’ve ready a script known as train_yolov8.py that can carry out the next duties. Let’s shortly assessment the important thing factors on this script earlier than you launch the coaching job.

  1. The coaching script will do the next: Load a YOLOv8 mannequin from the Ultralytics library
    mannequin = YOLO(args.yolov8_model)

  2. Use the prepare methodology to run fine-tuning that considers the mannequin information, adjusts its parameters, and optimizes its capacity to precisely predict object lessons and areas in pictures.
    tuned_model = mannequin.prepare(
            information=dataset_yaml,
            batch=args.batch_size,
            imgsz=args.img_size,
            epochs=args.epochs,
     
            ...

After the mannequin is skilled, the script runs inference to check the mannequin output and save the mannequin artifacts to a neighborhood Amazon S3 mapped folder

outcomes = mannequin.predict(
          information=dataset_yaml, 
          imgsz=args.img_size, 
          batch=args.batch_size
        )

mannequin.save(“<model_name>.pt")

3.2: Launch the coaching

You’re now able to launch the coaching. You’ll use the SageMaker PyTorch training estimator to provoke coaching. The estimator simplifies the coaching course of by automating a number of of the important thing duties on this instance:

  1. The SageMaker estimator spins up a coaching cluster of 1 2xlarge occasion. SageMaker handles the setup and administration of those compute situations, which reduces the full price of possession.
  2. The estimator additionally makes use of one of many pre-built containers managed by SageMaker—PyTorch, which incorporates an optimized compiled model of the PyTorch framework together with its required dependencies and GPU-specific libraries for accelerated computations.

The estimator.match() methodology initiates the coaching course of with the required enter information channels. Following is the code used to launch the coaching job together with the mandatory parameters.

estimator = PyTorch(
    entry_point="train_yolov8.py",
    source_dir="scripts",
    function=function,
    instance_count=instance_count,
    instance_type=instance_type,
    image_uri=training_image_uri,
    hyperparameters=hyperparameters,
    base_job_name="yolov8-finetuning",
    output_path=f"s3://{s3_bucket}/…"
)

estimator.match(
    {
        'coaching': sagemaker.inputs.TrainingInput(
            s3_data=uploaded_s3_uri,
            distribution='FullyReplicated',
            s3_data_type="S3Prefix"
        )
    }
)

You possibly can monitor a SageMaker coaching job by monitoring its standing utilizing the AWS Administration Console, AWS CLI, or AWS SDKs. To find out when the job is accomplished, test for the Accomplished standing or arrange Amazon CloudWatch alarms to inform you when the job transitions to the Accomplished state.

Step 4 & 5: Save, obtain and validate the skilled mannequin

The coaching course of generates mannequin artifacts that shall be saved to the S3 bucket laid out in output_path location. This instance makes use of the download_tar_and_untar utility to obtain the mannequin to a neighborhood drive.

  • Run inference on this mannequin and visually validate how shut floor reality and mannequin predictions bounding containers align on take a look at pictures. The next code exhibits generate a picture mosaic utilizing a customized utility operate—draw_bounding_boxes—that overlays a picture with floor reality and mannequin classification together with a confidence worth for sophistication prediction.
    image_mosiacs = []
    for i, _key in enumerate(image_label_pairs):
        img_path, lbl_path = image_label_pairs[_key]["image_path"], image_label_pairs[_key]["label_path"]
        consequence = mannequin([img_path], save=False)
        image_with_boxes = draw_bounding_boxes(
            yolo_result=consequence[0], 
            ground_truth=open(lbl_path).learn().splitlines(),
            confidence_threshold=0.2
        )
        image_mosiacs.append(np.array(image_with_boxes))

From the previous picture mosaic, you possibly can observe two distinct units of bounding containers: the cyan containers point out human annotations of defects on the PCB picture, whereas the purple containers characterize the mannequin’s predictions of defects. Together with the anticipated class, you may also see the boldness worth for every prediction, which displays the standard of the YOLOv8 mannequin’s output.

After fine-tuning, YOLOv8 begins to precisely predict the PCB defect lessons current within the customized dataset, despite the fact that it hadn’t encountered these lessons throughout mannequin pretraining. Moreover, the anticipated bounding containers are carefully aligned with the bottom reality, with confidence scores of larger than or equal to 0.5 most often. You possibly can additional enhance the mannequin’s efficiency with out the necessity for hyperparameter guesswork by utilizing a SageMaker hyperparameter tuning job.

Step 6: Run the mannequin on an actual system with Qualcomm AI Hub

Now that you just’re validated the fine-tuned mannequin on PyTorch, you wish to run the mannequin on an actual system.

Qualcomm AI Hub lets you do the next:

  1. Compile and optimize the PyTorch mannequin right into a format that may be run on a tool
  2. Run the compiled mannequin on a tool with a Snapdragon processor hosted in AWS system farm
  3. Confirm on-device mannequin accuracy
  4. Measure on-device mannequin latency

To run the mannequin:

  1. Compile the mannequin.

Step one is changing the PyTorch mannequin right into a format that may run on the system.

This instance makes use of a Home windows laptop computer powered by the Snapdragon X Elite processor. This system makes use of the ONNX mannequin format, which you’ll configure throughout compilation.

As you get started, you possibly can see an inventory of all of the gadgets supported on Qualcomm AI Hub, by working qai-hub list-devices.

See Compiling Models to be taught extra about compilation on Qualcomm AI Hub.

compile_job = hub.submit_compile_job(
    mannequin=traced_model,
    input_specs={"picture": (model_input.form, "float32")},
    system=target_device,
    title=model_name,
    choices="--target_runtime onnx"
)

  1. Inference the mannequin on an actual system

Run the compiled mannequin on an actual cloud-hosted system with Snapdragon utilizing the identical mannequin enter you verified domestically with PyTorch.

See Running Inference to be taught extra about on-device inference on Qualcomm AI Hub.

inference_job = hub.submit_inference_job(
    mannequin=compile_job.get_target_model(),
    inputs={"picture": [model_input.numpy()]},
    system=target_device,
    title=model_name,
)

  1. Profile the mannequin on an actual system.

Profiling measures the latency of the mannequin when run on a tool. It experiences the minimal worth over 100 invocations of the mannequin to finest isolate mannequin inference time from different processes on the system.

See Profiling Models to be taught extra about profiling on Qualcomm AI Hub.

profile_job = hub.submit_profile_job(
    mannequin=compile_job.get_target_model(),
    system=target_device,
    title=model_name,
)

  1. Deploy the compiled mannequin to your system

Run the command beneath to obtain the compiled mannequin.

The compiled mannequin can be utilized together with the AI Hub pattern utility hosted here. This utility makes use of the mannequin to run object detection on a Home windows laptop computer powered by Snapdragon that you’ve domestically.

compile_job.download_target_model()

Conclusion

Mannequin customization with your individual information by way of Amazon SageMaker—with over 250 fashions accessible on SageMaker JumpStart—is an addition to the present options of Qualcomm AI Hub, which embrace BYOM and entry to a rising library of over 100 pre-optimized fashions. Collectively, these options create a wealthy atmosphere for builders aiming to construct and deploy personalized on-device AI fashions throughout Snapdragon and Qualcomm platforms.

The collaboration between Amazon SageMaker and Qualcomm AI Hub will assist improve the person expertise and streamline machine studying workflows, enabling extra environment friendly mannequin improvement and deployment throughout any utility on the edge. With this effort, Qualcomm Applied sciences and AWS are empowering their customers to create extra personalised, context-aware, and privacy-focused AI experiences.

To be taught extra, go to Qualcomm AI Hub and Amazon SageMaker. For queries and updates, be a part of the Qualcomm AI Hub community on Slack.

Snapdragon and Qualcomm branded merchandise are merchandise of Qualcomm Applied sciences, Inc. or its subsidiaries


Concerning the authors

Rodrigo Amaral at the moment serves because the Lead for Qualcomm AI Hub Advertising and marketing at Qualcomm Applied sciences, Inc. On this function, he spearheads go-to-market methods, product advertising and marketing, developer actions, with a deal with AI and ML with a deal with edge gadgets. He brings nearly a decade of expertise in AI, complemented by a powerful background in enterprise. Rodrigo holds a BA in Enterprise and a Grasp’s diploma in Worldwide Administration.

Ashwin Murthy is a Machine Studying Engineer engaged on Qualcomm AI Hub. He works on including new fashions to the general public AI Hub Fashions assortment, with a particular deal with quantized fashions. He beforehand labored on machine studying at Meta and Groq.

Meghan Stronach is a PM on Qualcomm AI Hub. She works to help our exterior group and prospects, delivering new options throughout Qualcomm AI Hub and enabling adoption of ML on system. Born and raised within the Toronto space, she graduated from the College of Waterloo in Administration Engineering and has spent her time at firms of assorted sizes.

Kanwaljit Khurmi is a Principal Generative AI/ML Options Architect at Amazon Internet Providers. He works with AWS prospects to offer steerage and technical help, serving to them enhance the worth of their options when utilizing AWS. Kanwaljit focuses on serving to prospects with containerized and machine studying functions.

Pranav Murthy is an AI/ML Specialist Options Architect at AWS. He focuses on serving to prospects construct, prepare, deploy and migrate machine studying (ML) workloads to SageMaker. He beforehand labored within the semiconductor business creating massive laptop imaginative and prescient (CV) and pure language processing (NLP) fashions to enhance semiconductor processes utilizing cutting-edge ML methods. In his free time, he enjoys enjoying chess and touring. You’ll find Pranav on LinkedIn.

Karan JainKaran Jain is a Senior Machine Studying Specialist at AWS, the place he leads the worldwide Go-To-Market technique for Amazon SageMaker Inference. He helps prospects speed up their generative AI and ML journey on AWS by offering steerage on deployment, cost-optimization, and GTM technique. He has led product, advertising and marketing, and enterprise improvement efforts throughout industries for over 10 years, and is keen about mapping complicated service options to buyer options.

banner
Top Selling Multipurpose WP Theme

Converter

Top Selling Multipurpose WP Theme

Newsletter

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

banner
Top Selling Multipurpose WP Theme

Leave a Comment

banner
Top Selling Multipurpose WP Theme

Latest

Best selling

22000,00 $
16000,00 $
6500,00 $

Top rated

6500,00 $
22000,00 $
900000,00 $

Products

Knowledge Unleashed
Knowledge Unleashed

Welcome to Ivugangingo!

At Ivugangingo, we're passionate about delivering insightful content that empowers and informs our readers across a spectrum of crucial topics. Whether you're delving into the world of insurance, navigating the complexities of cryptocurrency, or seeking wellness tips in health and fitness, we've got you covered.