Fix model optimisation

This commit is contained in:
2026-04-09 08:09:02 +10:00
parent 34854d87f4
commit eeb205779a
10 changed files with 688 additions and 160 deletions

View File

@@ -18,7 +18,7 @@ int GPUYolov10EngineUnitTest(std::string modelFilePath, std::string videoFilePat
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType, 1,1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType, 1,1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -382,7 +382,7 @@ int Yolov8EngineUnitTest(std::string modelFilePath, std::string videoFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -475,7 +475,7 @@ int Yolov5EngineUnitTest(std::string modelFilePath, std::string videoFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -568,7 +568,7 @@ int Yolov12EngineUnitTest(std::string modelFilePath, std::string videoFilePath)
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -660,7 +660,7 @@ int GPUEngineUnitTest(std::string modelFilePath, std::string videoFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -753,7 +753,7 @@ int ONNXEngineUnitTest(std::string modelFilePath, std::string videoFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 0);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 0, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -844,7 +844,7 @@ int GPUEngineImageTest(std::string modelFilePath, std::string imageFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -920,7 +920,7 @@ int GPU11EngineImageTest(std::string modelFilePath, std::string imageFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType, 1,1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType, 1,1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType,1);
std::stringstream ss(labelMap);
@@ -996,7 +996,7 @@ int GPU11EngineUnitTest(std::string modelFilePath, std::string videoFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -1452,7 +1452,7 @@ int ODHUBAPITest(std::string modelFilePath, std::string videoFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, "", modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -1542,7 +1542,7 @@ int ODHUBOpenCVAPITest(std::string modelFilePath, std::string videoFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, "", modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -1633,7 +1633,7 @@ int ODHUBAPIImageTest(std::string modelFilePath, std::string imageFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, "", modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -1709,7 +1709,7 @@ int ODHUBCVAPIImageTest(std::string modelFilePath, std::string imageFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType, 1,1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType, 1,1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, "", modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -1937,7 +1937,7 @@ int DissemParallelTest(std::string modelFilePath, std::string imageFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType, 1,1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType, 1,1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, "", modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -2115,7 +2115,7 @@ int TiledInferenceTest(std::string modelFilePath, std::string imageFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, "", modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -2198,7 +2198,7 @@ int NormalInferenceTest(std::string modelFilePath, std::string imageFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, "", modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -2419,7 +2419,7 @@ int OpenVINOCLEngineImageTest(std::string modelFilePath, std::string imageFilePa
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -2495,7 +2495,7 @@ int TENSORRTCLEngineImageTest(std::string modelFilePath, std::string imageFilePa
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType,1, 1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);
@@ -2584,7 +2584,7 @@ int SegEngineImageTest(std::string modelFilePath, std::string imageFilePath) {
std::string optmizedModelFolder;
// Optimise model
std::cout << "Optimizing model, please wait...." << std::endl;
optmizedModelFolder = OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType, 1,1);
OptimizeModelStr(modelFilePath.c_str(), modelZipFilePassword.c_str(), modelType, 1,1, optmizedModelFolder);
std::cout << "Model is optmized, run inference...." << std::endl;
labelMap = CreateANSODHandle(&infHandle, licenseKey.c_str(), modelFilePath.c_str(), modelZipFilePassword.c_str(), modelThreshold, modelConfThreshold, modelNMSThreshold, 1, modelType, detectorType);
std::stringstream ss(labelMap);