Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
Signed-off-by: Yiheng Wang <[email protected]>
  • Loading branch information
yiheng-wang-nv committed Aug 21, 2024
1 parent d664577 commit 8c107d6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions models/vista2d/configs/hyper_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pretrained_ckpt_name: null
pretrained_ckpt_path: null

# for commandline setting of a single dataset
datalist: datalists/tissuenet_skin_mibi_datalist.json
basedir: /data/tissuenet
datalist: datalists/cellpose_datalist.json
basedir: /cellpose_dataset
data_list_files:
- {datalist: "@datalist", basedir: "@basedir"}

Expand Down
2 changes: 1 addition & 1 deletion models/vista2d/configs/inference.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
256,
256
],
"input_dict": "${'image': '/cellpose_dataset/test/001_img.png'}",
"input_dict": "${'image': '/home/venn/Desktop/data/medical/cellpose_dataset/test/001_img.png'}",
"device": "$torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')",
"sam_ckpt_path": "$@ckpt_dir + '/sam_vit_b_01ec64.pth'",
"pretrained_ckpt_path": "$@ckpt_dir + '/model.pt'",
Expand Down
14 changes: 14 additions & 0 deletions models/vista2d/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,23 @@ pip install git+https://github.com/facebookresearch/segment-anything.git
pip install mlflow psutil pynvml #optional for MLFlow support
```

### Prepare Data Lists and Datasets

The default dataset for training, validation, and inference is the [Cellpose](https://www.cellpose.org/) dataset. Please follow the [tutorial](../download_preprocessor/) to prepare the dataset before executing any commands below.

Additionally, all data lists are available in the `datalists.zip` file located in the root directory of the bundle. Extract the contents of the `.zip` file to access the data lists.

### Execute training
```bash
python -m monai.bundle run_workflow "scripts.workflow.VistaCell" --config_file configs/hyper_parameters.yaml
```

You can override the `basedir` to specify a different dataset directory by using the following command:

```bash
python -m monai.bundle run_workflow "scripts.workflow.VistaCell" --config_file configs/hyper_parameters.yaml --basedir <actual dataset ditectory>
```

#### Quick run with a few data points
```bash
python -m monai.bundle run_workflow "scripts.workflow.VistaCell" --config_file configs/hyper_parameters.yaml --quick True --train#trainer#max_epochs 3
Expand All @@ -64,6 +76,8 @@ torchrun --nproc_per_node=gpu -m monai.bundle run_workflow "scripts.workflow.Vis
python -m monai.bundle run --config_file configs/inference.json
```

Please note that the data used in the config file is: "/cellpose_dataset/test/001_img.png", if the dataset path is different or you want to do inference on another file, please modify in `configs/inference.json` accordingly.

### Execute multi-GPU inference
```bash
torchrun --nproc_per_node=gpu -m monai.bundle run_workflow "scripts.workflow.VistaCell" --config_file configs/hyper_parameters.yaml --mode infer --pretrained_ckpt_name model.pt
Expand Down
1 change: 0 additions & 1 deletion models/vista2d/download_preprocessor/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ To execute VISTA-2D training pipeline, some datasets require label conversion. P
`python generate_json.py --data_root provide_the_same_root_data_path`

### Generation of Json data lists (Optional)
All data lists are provided in the `datalists.zip` file located in the root directory of the bundle. Please extract the contents of the `.zip` file to access the data lists.
If one desires to generate JSON files from scratch, `generate_json.py` script performs both processing and creation of JSON files.
To execute VISTA-2D training pipeline, some datasets require label conversion and then a json file list which the VISTA-2D training uses a format.
Creating the json lists from the raw dataset sources, please use the `root_data_path` as the input to the script, example command to execute the script is given below:
Expand Down

0 comments on commit 8c107d6

Please sign in to comment.