iVS3D v2.0.0
Loading...
Searching...
No Matches
inference_segmentation.cpp File Reference

Example for performing segmentation inference using a neural network model. More...

#include <algorithm>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <chrono>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include "NeuralNetFactory.h"
#include "NeuralUtil.h"
#include "cxxopts.hpp"
#include "helpers.hpp"

Functions

int main (int argc, char **argv)
 Main function for segmentation inference example.
 

Detailed Description

Example for performing segmentation inference using a neural network model.

This example demonstrates how to load a segmentation model, perform inference on an input image, and save the segmentation result. It supports GPU inference if available.

Author
Dominik Wüst (domin.nosp@m.ik.w.nosp@m.uest@.nosp@m.iosb.nosp@m..frau.nosp@m.nhof.nosp@m.er.de)
Date
May 2025

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Main function for segmentation inference example.

This example demonstrates how to load a segmentation model, perform inference on an input image, and save the segmentation result. It also supports GPU inference if available.

Usage: ./inference_segmentation –model <model_path> –input <image_path> –output <output_dir> [–gpu <gpu_id>]

The model needs to be a segmentation model in onnx format with an argmax layer at the end. The input image should be a valid image file (e.g., jpg, png).