Error when executing engine_pool.json docker command - Annotation Server

Hello Everyone,

I am trying to start the annotation server by running the below command,

/opt/nvidia/medical/aas/start_aas.sh --config /var/tmp/models/engine_pool.json

However, I am getting the below error as shown in the attached file.

Do note that I am only trying for the annotation_spleen model.

Please find my engine_pool.json code

{
"name": "MyAnnotationSpleenModel",
"class": "Dextr3dCroppedEngine",
"module": "medical.aas.dextr3dcropped",
"config_file": "/var/tmp/models/annotation_spleen.json",
"labels": ["spleen"]
}

Request your help

Can anyone please help me with this?

Hi

Looks like your engine_pool.json is missing [ and ] in the beginning and end, so your file should look like

[
{
“name”: “MyAnnotationSpleenModel”,
“class”: “Dextr3dCroppedEngine”,
“module”: “medical.aas.dextr3dcropped”,
“config_file”: “/var/tmp/models/spleen.json”,
“labels”: [“spleen”]
}
]

This should fix the error.
Also please note the blog https://devblogs.nvidia.com/annotation-transfer-learning-clara-train/ was recently updated.

Hello,

I was following the blog suggested above and was able to execute example.cpp file after making multiple modifications. Will the blog be upated?

Please find my example.cpp file which I used

#include </home/selva/include/nvidia/aiaa/client.h>
#include <iostream>

using namespace nvidia;
using namespace aiaa;
using namespace Pixel;

int main() {
   try {
      // Create AIAA Client object
      nvidia::aiaa::Client client("http://127.0.0.1:5000/v1");

      // List all models
      nvidia::aiaa::ModelList modelList = client.models();
      std::cout << "Models Supported by AIAA Server: " << modelList.toJson() << std::endl;

      // Get matching model for organ Spleen
      nvidia::aiaa::Model model = modelList.getMatchingModel("spleen");
      std::cout << "Selected AIAA Model for organ 'Spleen' is: " << model.toJson(2) << std::endl;

 // More API calls can follow here...
      std::string inputImageFile = "image.nii.gz";
      std::string outputDextr3dImageFile = "result.nii.gz";
      nvidia::aiaa::PointSet point3Set = nvidia::aiaa::PointSet::fromJson("[[1,2,3]]");
      int PAD = 20; // Padding boundary
      Pixel::Type pt = INT;
      std::string ROI_SIZE = "128x128x128";
      const int SIGMA = 3;

      int ret = client.dextr3D(model, point3Set, inputImageFile,pt, outputDextr3dImageFile);

      int pointRatio = 10;
      nvidia::aiaa::PolygonsList result = client.maskToPolygon(pointRatio, outputDextr3dImageFile);

      int neighborhoodSize = 10;
      nvidia::aiaa::Polygons p1 = nvidia::aiaa::Polygons::fromJson("[[10,20],[20,30]");
      nvidia::aiaa::Polygons p2 = nvidia::aiaa::Polygons::fromJson("[[10,20],[21,31]]");
      int polygonIndex = 0;
      int vertexIndex = 1;
      std::string input2DImageFile = "image_slice_2D.png";
      std::string output2DImageFile = "updated_slice_2D.png";
      // fixPolygon():: Call Fix Polygon with new Polygon Points
      nvidia::aiaa::Polygons results = client.fixPolygon(p1, p2, neighborhoodSize, polygonIndex, vertexIndex, 
  input2DImageFile, output2DImageFile);

   } catch (nvidia::aiaa::exception& e) {
      std::cerr << "nvidia::aiaa::exception => nvidia.aiaa.error." << e.id << "; description: " << e.name()<< std::endl;

 } catch (nvidia::aiaa::exception& e) {
      std::cerr << "nvidia::aiaa::exception => nvidia.aiaa.error." << e.id << "; description: " << e.name() << std::endl;

 }

   return 0;
}

Though I was able to successfully compile and execute after fixing some issues with example.cpp, I also had the below error as shown in the attachment. As I am new to image processing and analysis, trying to learn.

Can you post your spleen.json?

Here is the spleen.json

{
    "model_format": "trtmodel",
    "model_path": "/var/tmp/models/annotation_spleen/model.trt.pb",
    "thresh": 0.5,
    "result_dir": "/var/tmp/experiments/aiaa",

    "input_nodes":
    {
        "image": "cond/Merge"
    },

    "output_nodes":
    {
        "model": "NV_OUTPUT_LABEL"
    },

    "batch_size": 1,

    "pre_transforms":
    [    
        {
            "name": "transforms.VolumeTo4dArray",
            "fields": ["image", "label"]
        },           
        {
            "name": "transforms.ScaleIntensityRange",
            "field": "image",
            "a_min": -1024,
            "a_max": 1024,
            "b_min": -1.0,
            "b_max": 1.0,
            "clip": true
        },        
        {
            "name": "transforms.AddExtremePointsChannel",
            "image_field": "image",
            "label_field": "label",
            "sigma": 3,
            "pert": 0
        }                
    ],

    "post_transforms":
    [ 
        {
            "name": "transforms.SplitAcrossChannels",
            "applied_key": "model", 
            "channel_names": ["background", "prediction"]
        }        
    ],

    "writers":
    [
        {
            "applied_key": "prediction",
            "name": "writers.WriteNiftyResults",
            "dtype": "float32"
        }               
    ]
}

Hello Alvin,

Any issue with my spleen.json file?

It looks correct.

Are building your own custom AIAA client?

No. Curently,we aren’t planning to build custom client. We are only using MITK. So, then I think we don’t have to bother about example.cpp file.

Thanks
Selva