From abc235396eea0623c8557e155312d77c60e78f6f Mon Sep 17 00:00:00 2001 From: Waruna Priyankara J A Wickramasingha <142818102+warunawickramasingha@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:19:25 +0100 Subject: [PATCH] Update README.md with latest instructions --- diffraction/WISH/bragg-detect/cnn/README.md | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/diffraction/WISH/bragg-detect/cnn/README.md b/diffraction/WISH/bragg-detect/cnn/README.md index 313e6a8..461e095 100644 --- a/diffraction/WISH/bragg-detect/cnn/README.md +++ b/diffraction/WISH/bragg-detect/cnn/README.md @@ -1,22 +1,16 @@ -Bragg Peaks detection using a Faster RCNN model +Bragg Peaks detection using a pre-trained Faster RCNN deep neural network ================ -Inorder to use the pretrained Faster RCNN model inside mantid, below steps are required. +Inorder to use the pre-trained Faster RCNN model inside mantid using an IDAaaS instance, below steps are required. -* Install mantid from conda `mamba create -n mantid_cnn -c mantid mantidworkbench` -* Activate the conda environment with `mamba activate mantid_cnn` -* Launch workbench from `workbench` command -* Download the script repository's `scriptrepository\diffraction\WISH` directory as instructed here https://docs.mantidproject.org/nightly/workbench/scriptrepository.html -* Check whether `\diffraction\WISH` path is available at `Python Script Directories` tab from `File->Manage User Directories`. -* Close the workbench -* From command line, change the directory to the place where the scripts were downloaded ex: `\diffraction\WISH\bragg-detect\cnn` -* Within the same conda enviroment, install pytorch dependancies by running `pip install -r requirements.txt` -* Install NVIDIA CUDA Deep Neural Network library (cuDNN) by running `conda install -c anaconda cudnn` -* Re-launch workbench from `workbench` command +* Launch an IDAaaS instance with GPUs from WISH > Wish Single Crystal GPU Advanced +* Launch Mantid workbench nightly from Applications->Software->Mantid->Mantid Workbench Nightly +* Download `scriptrepository\diffraction\WISH` directory from mantid's script repository as instructed here https://docs.mantidproject.org/nightly/workbench/scriptrepository.html +* Check whether `\diffraction\WISH` path is listed under `Python Script Directories` tab from `File->Manage User Directories` of Mantid workbench. * Below is an example code snippet to test the code. It will create a peaks workspace with the inferred peaks from the cnn and will do a peak filtering using the q_tol provided using `BaseSX.remove_duplicate_peaks_by_qlab`. ```python from cnn.BraggDetectCNN import BraggDetectCNN -model_weights = r'path/to/pretrained/fasterrcnn_resnet50_model_weights.pt' +model_weights = r'/mnt/ceph/auxiliary/wish/BraggDetect_FasterRCNN_Resnet50_Weights_v1.pt' cnn_peaks_detector = BraggDetectCNN(model_weights_path=model_weights, batch_size=64) cnn_peaks_detector.find_bragg_peaks(workspace='WISH00042730', output_ws_name="CNN_Peaks", conf_threshold=0.0, q_tol=0.05) ```