Skip to content

Commit e3c02a8

Browse files
authored
Merge pull request #29 from sarthakpati/master
0.0.3 ready
2 parents f2e3576 + e6a4402 commit e3c02a8

File tree

5 files changed

+54
-25
lines changed

5 files changed

+54
-25
lines changed

CMakeLists.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SET( ${PROJECT_NAME}_Variant "Full" ) # the particular variant of CaPTk (Full/Ne
1313

1414
SET( PROJECT_VERSION_MAJOR 0 )
1515
SET( PROJECT_VERSION_MINOR 0 )
16-
SET( PROJECT_VERSION_PATCH 3-dev )
16+
SET( PROJECT_VERSION_PATCH 3 )
1717
SET( PROJECT_VERSION_TWEAK )
1818

1919
# check for the string "nonRelease" in the PROJECT_VERSION_PATCH variable
@@ -596,18 +596,18 @@ IF( NOT BUILD_DOCUMENTATION_ONLY )
596596
ENDIF()
597597
ENDIF()
598598

599-
# SET( DOWNLOAD_LINK "ftp://www.nitrc.org/home/groups/captk/downloads/models/torch/pt_3dresunet_fets_phase1_brats20pretrained_init_1.pbuf" )
600-
# SET( FILE_TO_EXTRACT "${PROJECT_SOURCE_DIR}/OpenFederatedLearning/bin/federations/weights/pt_3dresunet_fets_phase1_brats20pretrained_init_1.pbuf")
599+
SET( DOWNLOAD_LINK "ftp://www.nitrc.org/home/groups/captk/downloads/models/torch/pt_3dresunet_fets_phase1_brats20pretrained_init_1.pbuf" )
600+
SET( FILE_TO_EXTRACT "${PROJECT_SOURCE_DIR}/OpenFederatedLearning/bin/federations/weights/pt_3dresunet_fets_phase1_brats20pretrained_init_1.pbuf")
601601

602-
# IF( NOT EXISTS "${FILE_TO_EXTRACT}" )
602+
IF( NOT EXISTS "${FILE_TO_EXTRACT}" )
603603

604-
# # download exe from url
605-
# MESSAGE( STATUS "Downloading weights for BraTS evaluation model" )
606-
# FILE(DOWNLOAD "${DOWNLOAD_LINK}" "${FILE_TO_EXTRACT}" TIMEOUT 1000000 STATUS STATUS_CODE SHOW_PROGRESS)
607-
# IF(NOT STATUS_CODE EQUAL 0)
608-
# MESSAGE(FATAL_ERROR "Failed to download BraTS evaluation model weights. Status=${STATUS_CODE}")
609-
# ENDIF()
610-
# ENDIF()
604+
# download exe from url
605+
MESSAGE( STATUS "Downloading weights for BraTS evaluation model" )
606+
FILE(DOWNLOAD "${DOWNLOAD_LINK}" "${FILE_TO_EXTRACT}" TIMEOUT 1000000 STATUS STATUS_CODE SHOW_PROGRESS)
607+
IF(NOT STATUS_CODE EQUAL 0)
608+
MESSAGE(FATAL_ERROR "Failed to download BraTS evaluation model weights. Status=${STATUS_CODE}")
609+
ENDIF()
610+
ENDIF()
611611

612612
# copy network information
613613
## todo: change to a direct installation so that git doesn't get confused that submodule has changed

OpenFederatedLearning

data/cwlFiles/FeTS_CLI.cwl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ inputs:
3030
position: 1
3131
prefix: -cwl
3232
doc: Generates a .cwl file for the software.
33+
trainPlan:
34+
type: boolean?
35+
label: YAML file
36+
inputBinding:
37+
position: 1
38+
prefix: -tp
39+
doc: Training plan.Defaults to 'fets_phase1_1'.
3340
LoggingDir:
3441
type: Directory?
3542
label: Dir with write access

docs/runningApplication.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,19 @@ wget https://raw.githubusercontent.com/FETS-AI/Front-End/master/src/applications
143143

144144
## Training
145145

146+
### Ensure Sanity Checking Is Done
147+
148+
Proceed to training once [sanity check](#sanity-check) is successfully finished.
149+
### Transfer Certificates
150+
151+
If you have a [signed certificate from a previous installation](https://fets-ai.github.io/Front-End/setup#set-up-the-collaborator), ensure they are copied **before** trying to train:
152+
```bash
153+
cd ${fets_root_dir}/bin/
154+
cp -r ${fets_root_dir_old}/bin/OpenFederatedLearning/bin/federations/pki/client ./OpenFederatedLearning/bin/federations/pki
155+
```
156+
157+
### Start Training
158+
146159
```bash
147160
${fets_root_dir}/bin/FeTS_CLI -d /path/to/output/DataForFeTS \ # input data, ensure "final_seg" is present for each subject
148161
-c ${collaborator_common_name} \ # common collaborator name created during setup

src/applications/FeTS_CLI.cxx

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ int main(int argc, char** argv)
6060
}
6161
else
6262
{
63-
loggingDir = dataDir + "/logs";
63+
loggingDir = cbica::createTemporaryDirectory() + "/logs";
64+
std::cout << "Using the following directory as logging directory: " << loggingDir << "\n";
6465
cbica::createDir(loggingDir);
6566
}
6667

@@ -398,30 +399,38 @@ int main(int argc, char** argv)
398399
} // end of trainingRequested check
399400
else // for training
400401
{
401-
std::string specialArgs, args, hardcodedModelName;
402-
if (trainingRequested)
403-
{
404-
specialArgs = "-col " + colName;
405-
}
406-
402+
std::string args = " -d " + dataDir + " -ld " + loggingDir + " -col " + colName + device_arg,
403+
hardcodedModelName;
404+
407405
if (!cbica::isFile(hardcodedPythonPath))
408406
{
409407
std::cerr << "The python virtual environment was not found, please refer to documentation to initialize it.\n";
410408
return EXIT_FAILURE;
411409
}
410+
411+
{
412+
std::cout << "Starting model validation of 3DResUNet trained on BraTS20 training data...\n";
413+
414+
// brats20 model validation
415+
std::string fullCommandToRun = hardcodedPythonPath + " " + fetsApplicationPath;
416+
fullCommandToRun += "/OpenFederatedLearning/bin/run_fets_validation.py";
417+
418+
auto temp_args = args + " -p fets_phase1_validate_full_brats_trained_model_1.yaml";
419+
420+
if (std::system((fullCommandToRun + " " + temp_args).c_str()) != 0)
421+
{
422+
std::cerr << "Couldn't complete the BraTS20 model validation task, please email [email protected]\n";
423+
}
424+
}
412425

413426
std::string fullCommandToRun = hardcodedPythonPath + " " + fetsApplicationPath;
414427
fullCommandToRun += "/OpenFederatedLearning/bin/run_collaborator_from_flplan.py";
415428

416-
args += " -p " + hardcodedPlanName + ".yaml"
417-
+ " -d " + dataDir
418-
+ " -ld " + loggingDir;
419-
420-
args += device_arg;
429+
auto temp_args = args + " -p " + hardcodedPlanName + ".yaml";
421430

422431
std::cout << "Starting training...\n";
423432

424-
if (runCollaboratorTraining(fullCommandToRun + " " + args + " " + specialArgs) != 0)
433+
if (runCollaboratorTraining(fullCommandToRun + " " + temp_args) != 0)
425434
{
426435
std::cerr << "Couldn't complete the training task, please email [email protected]\n";
427436
return EXIT_FAILURE;

0 commit comments

Comments
 (0)