smistad / FAST

A framework for high-performance medical image processing, neural network inference and visualization
https://fast.eriksmistad.no
BSD 2-Clause "Simplified" License
433 stars 101 forks source link

Error in network.runAndGetOutputData() #202

Closed ggg5438 closed 8 months ago

ggg5438 commented 8 months ago

Thank you for your great work.

I followed your tutorial, but there is an error where Kernel died.

image

I am using Ubuntu 20.04, and python 3.8. Is there any other requirements for the code, including the version of tensorflow?

smistad commented 8 months ago

Hi @ggg5438

Thank you for reporting this. It seems there is a missing a \ and the end of the line .create(fast.Config.getTestDataPath() + 'NeuralNetworkModels/jugular_vein_segmentation.onnx')

So the example should be like this:

import fast

# Set up image importer to load an ultrasound image
importer = fast.ImageFileImporter\
    .create(fast.Config.getTestDataPath() + '/US/JugularVein/US-2D_100.mhd')

# Load neural network from a file and connect it to the importer
network = fast.NeuralNetwork\
    .create(fast.Config.getTestDataPath() + 'NeuralNetworkModels/jugular_vein_segmentation.onnx')\
    .connect(importer)

# Run the pipeline and get the resulting tensor
tensor = network.runAndGetOutputData()
print('Shape of output tensor is ', tensor.getShape().toString())