migueldeicaza / TensorFlowSharp

TensorFlow API for .NET languages
MIT License
3.14k stars 577 forks source link

how to get the output value including the tuple? #475

Open khseob0715 opened 4 years ago

khseob0715 commented 4 years ago

I have used this library before. Previously, it was easy to use because only one result was obtained.

I am currently trying to utilize Mask RCNN in unity I've written some code, but there's a problem with the way I get the output.

`

runner.AddInput(graph["input_image"][0], input_image_tensor)
                      .AddInput(graph["input_image_meta"][0], input_image_meta_tensor)
                      .Fetch(graph["mrcnn_detection/Reshape_1"][0])
                      .Fetch(graph["mrcnn_class/Reshape_1"][0])
                      .Fetch(graph["mrcnn_bbox/Reshape"][0])
                      .Fetch(graph["mrcnn_mask/Reshape_1"][0]);

TFTensor mrcnn_detection = output[0];       
     // Returns: [batch, num_detections, (y1, x1, y2, x2, class_id, score)]  in python model.py
TFTensor mrcnn_class = output[1]; 
TFTensor mrcnn_bbok = output[2];
TFTensor mrcnn_mask = output[3];       
     // Returns: Masks [batch, num_rois, MASK_POOL_SIZE, MASK_POOL_SIZE, NUM_CLASSES]    in python model.py

Debug.Log(mrcnn_detection.GetValue(jagged: true).GetType());  // System.Single[][][]

`

I want to get the return value of detection, which is the first output.

This returns (float float tuple) at model.py on the mask rcnnn.

But, the Getvalue() returned the single[][][] types.

I don't know how to handle this output.

Please give me some advice.

Thank you in advance.

chrigui94 commented 4 years ago

Hello @khseob0715, did you find any solution to handle MaskRcnn model using TensorflowSharp? I have the same case and I am blocked.