Skip to content

Training STNeuroNet

soltanianzadeh edited this page Mar 29, 2019 · 2 revisions

For training the network with any data, the data needs to be in the compatible format and naming. Specifically, the data should be saved in name_processed.nii.gz and the neuron masks should be saved as FinalMasks_name.mat formats, in which “name” is the name of the data. Given such data, the demo codes listed below will prepare the data for training (filtering the recordings and generating temporal labeling). The Python codes will launch the network as well, but for MATLAB, the user needs to run the network in train mode after preprocessing is over. Details can be found under the MATLAB section.

Python demos:

  • demo_train.py: shows how to prepare training data and train STNeuroNet
  • RunThresh.py: demo on how to find the optimal thresholds for the postprocessing step from Allen training data for 10 cross-validation trained networks

MATLAB demos:

  • demo_preprocess.m: demonstrates how to apply preprocessing to a data from Allen
  • demo_optThresh.m: finding the optimal thresholds for the postprocessing step from a predefined Allen training dataset

After preprocessing the data, the user should setup the network’s configuration file and run the trained network through the Anaconda prompt as described in the next section. After the probability maps are generated by STNeuroNet, the user can apply postptocessing steps to infer the final neuron masks. A demo, named demo_postprocess.m, is provided that shows how to apply postprocesing to an inferred probability map from the Allen data.

Running the network through command prompt:

To evoke the network from the Anaconda command prompt, type the following:

net_segment [train|inference] –c <path_to/config.ini>

where train will update the weights of the network based on the data specified in the configuration file (config.ini), and inference will generate predictions by loading a pre-trained network. For details about the configuration file, please refer to NiftyNet's website. Note that we used an older version of NiftyNet and some added features to the configuration file will not work with the current setup (e.g., dataset_split_file). We have provided a sample configuration file that shows which features can be used.

After the probability maps are generated by STNeuroNet, the user can run the demo_optThresh.m file to achieve the best combination of thresholds for the probability maps and minimum mask size.

Clone this wiki locally