Skip to content

Generate Semantic Segmentation Output mask #9

Open
@shreshtashetty

Description

@shreshtashetty

Hi
I was trying to carry out inference from the pre-trained model following the ros2 deployment instructions. I was able to execute that successfully.
I want to enable the semantic segmentation output as well, so to enable that I followed below steps.

  1. Generated .onnx file using this command with --enable-semantic flag.
python3 onnx_conversion.py -p <checkpoint> -o <onnx_file_path> --enable-semantic

and converted it to trt.engine file

  1. Then checked the dimensions for the segmentation mask using the output of ONNX file
for output in onnx_model.graph.output:
    print(f"Output Name: {output.name}, Shape: {output.type.tensor_type.shape}")
  1. After that modified the x_mobility_navigator.py file and made below modifications
    a. Initialized the variable here self.segmentation_output = np.zeros((1, 1, 7, 320, 512), dtype=np.float32)
    b. Then in this function added cuda.mem_alloc, cuda.memcpy_htod, cuda.memcpy_dtoh for the same

  2. When I ran the inference I got the masks but the values are zero

  • I am getting the right shape (1, 1, 7, 320, 512)
  • but all the values are zero
Segmentation Output: [[[[[0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     ...
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]]
[x_mobility_navigator-1] 
[x_mobility_navigator-1]    [[0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     ...
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]]
[x_mobility_navigator-1] 
[x_mobility_navigator-1]    [[0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     ...
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]]
[x_mobility_navigator-1] 
[x_mobility_navigator-1]    ...
[x_mobility_navigator-1] 
[x_mobility_navigator-1]    [[0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     ...
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]]
[x_mobility_navigator-1] 
[x_mobility_navigator-1]    [[0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     ...
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]]
[x_mobility_navigator-1] 
[x_mobility_navigator-1]    [[0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     ...
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]
[x_mobility_navigator-1]     [0. 0. 0. ... 0. 0. 0.]]]]]

Any suggestions and swift response will be highly appreciated.
Thanks in advance, and anything to be kept in mind as I am planning on generating the dataset and train it for my use-case with 5 classes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions