# Dictionary Learning/ Sparse Coding Project: # 10.10.2022 | Exp No. | Data | Model | | -------- | -------- | -------- | | 1 | ATM22 | ResUNet | 2 | ATM22 | AttentionUNet | 3 | SparseATM22 | ResUNet | 4 | SparseATM22 | AttentionUNet | 5 | Dual-channel | ResUNet | 6 | Dual-channel | AttentionUNet # 08.10.2022 1. Introduction (30%) 2. Background (50%) 3. Related Works (80%) 4. Data Insight (90%) 5. Sparse Representation of CT scans (0%) 6. Airway Segmentation using Sparse Representations of CT scans (0%) 7. Conclusion and Future Works (0%) # 06.10.2022 Papers to read for later: https://link.springer.com/content/pdf/10.1007/978-3-030-87193-2_39.pdf # 05.10.2022 epoch 500 average loss: 0.0391 1/8, Val_loss: 0.0531 2/8, Val_loss: 0.4315 3/8, Val_loss: 0.0312 4/8, Val_loss: 0.0482 5/8, Val_loss: 0.0636 6/8, Val_loss: 0.0444 7/8, Val_loss: 0.0414 8/8, Val_loss: 0.0418 current epoch: 500 current mean dice: 0.9056 best mean dice: 0.9069 at epoch: 338 # 29.09.2022 3D Binary segmentation results: Volume-based 3D Binary Segmentation results **Model information**: Model name: Attention Unet based on Otkay et al. “Attention U-Net: Learning Where to Look for the Pancreas” https://arxiv.org/abs/1804.03999 <!-- Number of Parameters: 9,525,887 --> spatial_dims=3 in_channels=1 out_channels=2 channels=(16, 32, 64, 128, 256) strides=(2, 2, 2, 2) dropout=0.15 Loss: DiceLoss (explained in this paper https://arxiv.org/abs/1606.04797) Optimizer: Adam, Learning rate=1e-3 [LINK](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html#torch.optim.Adam) Scheduler: StepLR(optimizer, step_size=1000, gamma=0.1) Batch size: 2 cases Related libraries: Pytorch, MONAI **Data Information**: - Training Size: 20 cases - Patches 256 * 256 * 256 - Validation Size: 4 cases - Patches 256 * 256 * 256 Validation DiceScore plot: ![](https://i.imgur.com/1BE4kxS.png) Examples: The gray is the provided ground-truth while the red is the predictions. (note: FP, FN visualization should be added after finishing the post-processing phase) ![](https://i.imgur.com/fRVDpYt.gif) # 28.09.2022 3D Binary segmentation results: Volume-based 3D Binary Segmentation results **Model information**: Model name: ResidualUNet (based on: Left-Ventricle Quantification Using Residual U-Net) [LINK](https://link.springer.com/chapter/10.1007/978-3-030-12029-0_40) Number of Parameters: 9,525,887 spatial_dims=3 in_channels=1 out_channels=2 channels=(16, 32, 64, 128, 256) strides=(2, 2, 2, 2) num_res_units=4 dropout=0.15 Loss: DiceLoss (explained in this paper https://arxiv.org/abs/1606.04797) Optimizer: Adam, Learning rate=1e-3 [LINK](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html#torch.optim.Adam) Scheduler: StepLR(optimizer, step_size=1000, gamma=0.1) Batch size: 2 cases Related libraries: Pytorch, MONAI **Data Information**: - Training Size: 20 cases - Patches 256 * 256 * 256 - Validation Size: 4 cases - Patches 256 * 256 * 256 Validation DiceScore plot: ![](https://i.imgur.com/5oFTl89.png) Examples: The gray is the provided ground-truth while the red is the predictions. (note: FP, FN should be added after finishing the post-processing phase) ![](https://i.imgur.com/jihEAyY.gif) ![](https://i.imgur.com/LRqRNPs.gif) # 27.09.2022 - Working on the report (Chapter datasets) # 26.09.2022 3D segmentation of the whole volume: # 22.09.2022 Patch-based 3D Binary Segmentation results (Using only sparse representations): **Model information**: Model name: Residual UNet (based on: Left-Ventricle Quantification Using Residual U-Net) [LINK](https://link.springer.com/chapter/10.1007/978-3-030-12029-0_40) Number of Parameters: 9,525,887 spatial_dims=3 in_channels=1 out_channels=2 channels=(16, 32, 64, 128, 256) strides=(2, 2, 2, 2) num_res_units=4 dropout=0.15 Loss: DiceLoss (explained in this paper https://arxiv.org/abs/1606.04797) Optimizer: Adam, Learning rate=1e-3 [LINK](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html#torch.optim.Adam) Scheduler: StepLR(optimizer, step_size=200, gamma=0.1) Batch size: 10 cases Maximum number of Patches: 100 (if the number of patches is more than 100, we randomly select 100 patches) Related libraries: Pytorch, MONAI **Data Information**: - Training Size: 20 cases - Patches 64 * 64 * 64 - All patches contains at least 1% airway - Validation Size: 4 cases - Patches 64 * 64 * 64 - All patches contains at least 1% airway Loss plot: ![](https://i.imgur.com/Mm4tlAN.png) Validation DiceScore plot: ![](https://i.imgur.com/yUhHhJe.png) Examples: First column: random slice of a random 64^3 patch Second column: corresponding ground truth Third column: predicted mask ![](https://i.imgur.com/HTrGeMr.png) ![](https://i.imgur.com/Ruio4zW.png) # 20.09.2022 Just internal lung regions: https://drive.google.com/drive/folders/1I641f-Fkcf3rmjD0jQIDfK8yDt42fbvs <!-- ![](https://i.imgur.com/nHFFj9Q.gif) --> Link to the nii file (CT, SparseRepr, GroundTruth mask): Upload to drive # 19.09.2022 Patch-based 3D Binary Segmentation results: **Model information**: Model name: UNet (based on: Left-Ventricle Quantification Using Residual U-Net) [LINK](https://link.springer.com/chapter/10.1007/978-3-030-12029-0_40) Number of Parameters: 9,525,887 spatial_dims=3 in_channels=1 out_channels=2 channels=(16, 32, 64, 128, 256) strides=(2, 2, 2, 2) num_res_units=4 dropout=0.15 Loss: DiceLoss (explained in this paper https://arxiv.org/abs/1606.04797) Optimizer: Adam, Learning rate=1e-3 [LINK](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html#torch.optim.Adam) Scheduler: StepLR(optimizer, step_size=200, gamma=0.1) Batch size: 10 cases Maximum number of Patches: 100 (if the number of patches is more than 100, we randomly select 100 patches) Related libraries: Pytorch, MONAI **Data Information**: - Training Size: 20 cases - Patches 64 * 64 * 64 - All patches contains at least 1% airway - Validation Size: 4 cases - Patches 64 * 64 * 64 - All patches contains at least 1% airway Loss plot: ![](https://i.imgur.com/U1iQrOx.png) Validation DiceScore plot: ![](https://i.imgur.com/25AWTqJ.png) Examples: First column: random slice of a random 64^3 patch Second column: corresponding ground truth Third column: predicted mask ![](https://i.imgur.com/ruwYFmT.jpg) First column: random slice of a random 64^3 patch Second column: corresponding ground truth Third column: predicted mask ![](https://i.imgur.com/mVN4VhG.png) <!-- ![](https://i.imgur.com/jJ5etex.jpg) ![](https://i.imgur.com/jdN4DwG.jpg) ![](https://i.imgur.com/FHyRF9q.jpg) ![](https://i.imgur.com/Lo3dneP.jpg) ![](https://i.imgur.com/aigbFXc.jpg) ![](https://i.imgur.com/CAD0dVx.jpg) ![](https://i.imgur.com/5Bcb5Ox.jpg) ![](https://i.imgur.com/iZc1q1q.jpg) --> # 14.09.2022 Note1: Airway-volume ratio in all the cases are less than 1% (~0.1%). ATM_006_0000.nii The airway/volume ratio is 0.0015995502471923828 ATM_009_0000.nii The airway/volume ratio is 0.0013994574546813965 ATM_015_0000.nii The airway/volume ratio is 0.0015857219696044922 ATM_012_0000.nii The airway/volume ratio is 0.0015171170234680176 Note: In each case there are ~15 (64^3) patches containing more than 1% airway. # 13.09.2022 Patch-based 3D segmentations: **Model information**: Model name: UNet (based on: Left-Ventricle Quantification Using Residual U-Net) [LINK](https://link.springer.com/chapter/10.1007/978-3-030-12029-0_40) Number of Parameters: 9,525,887 Dropout = 0.15 (without any dropout for this experiment) Loss: DiceLoss Optimizer: Adam, Learning rate=1e-2 [LINK](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html#torch.optim.Adam) Scheduler: StepLR(optimizer, step_size=50, gamma=0.1) Batch size: 2 cases Related libraries: Pytorch, MONAI **Data Information**: - Training Size: 42 cases - Patches 64 * 64 * 64 - 50% Contains airway, 50% not airways - Validation Size: 8 cases - Patches 64 * 64 * 64 - 50% Contains airway, 50% not airways **Other detailes**: Intensity range = [-1000, 200] with clipping then scale to [0,1] voxel size = [1, 1, 1.5] **Plots** Training Vs. Validation Loss: Mean Dice Score: Volume 3D segmentations: # 12.09.2022 3D classification results: **Model information**: Model name: DenseNet (based on: Densely Connected Convolutional Networks [LINK](https://arxiv.org/pdf/1608.06993.pdf)) Number of Parameters: 11.2 M Dropout = 0.1 (without any dropout for this experiment) Loss: Binary Cross Entropy (WithLogitsLoss) [LINK](https://pytorch.org/docs/stable/generated/torch.nn.BCEWithLogitsLoss.html#torch.nn.BCEWithLogitsLoss) Optimizer: Adam, Learning rate=1e-5 [LINK](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html#torch.optim.Adam) Batch size: 2 cases Related libraries: Pytorch, MONAI **Data Information**: - Training Size: 42 cases - Patches 64 * 64 * 64 - 50% Contains airway, 50% not airways - Validation Size: 8 cases - Patches 64 * 64 * 64 - 50% Contains airway, 50% not airways **Other detailes**: Intensity range = [-1000, 200] with clipping then scale to [0,1] voxel size = [1.5, 1.5, 2] Plots: ![](https://i.imgur.com/LsYNKOW.png) ![](https://i.imgur.com/vNO3Oro.png) # 08.09.2022 UNet model is not converging. 3D Segmentation debugging. # 07.09.2022 **3D Patch Binary Classification (3DPBC) results** Patch-labeling: 1 if contains the airway 0 if does not contain any airway (Case ATM_030_0000): ![](https://i.imgur.com/jV9nzyj.gif) 3DPBC test results Here are the patches that we predicted the wrong labels for them: From the 64 patches, there are 3 patches containing airway that we predicted as non-airway. Patch 1: In this patch, there is only two slices that contains airways, slice indices [0,1], in this patch the ratio of non-zero pixels is 7.62939453125e-06 Patch 2: In this patch, there is only two slices that contains airways, slice indices [62,63], in this patch the ratio of non-zero pixels is 3.814697265625e-05 Patch 3: In this patch, there is seven slices that contains airways, slice indices [0,1,5,6,7,8,9], in this patch the ratio of non-zero pixels is 0.00020599365234375 ![](https://i.imgur.com/Q5mCf26.jpg) The airway is close to the borders. ref paper: https://link.springer.com/content/pdf/10.1007/978-3-319-59050-9_28.pdf Note: - Possibility of "border effect": Due to the fact that our models mistakes are in patches the airways are close to the borders. - The number of pixels containing airway is negligble for our model, but there are cases with only few airways (close to the center) that our model has predicted correctly. - The patch 1 and patch 2 are among the 3 patches with least number of airway pixels; The most sparse patch has it's non-zero values close to the center of the patch (only one slice) <!-- Binary Segmentation Results: --> <!-- The loss is not converging at the moment I need to check the Hyperparams to see where is the problem --> <!-- Current Tasks: - Run experiments on INFRES cluster --> On progress <!-- - Binary **Segmentation** pipeline using MONAI and Pytorch Lightning. - Dataset class = Done - Preprocessing and Transforms = Done - DataLoaders = Done - Pytorch Lightning class = Done - Training, and validation procedure = Done - Report: - Introduction - Datasets <-- - Literature Review <-- - Sparse Representation of Lung CT volumes <-- - Patch-based Airways Segmentation <-- - Conclusion and Discussions --> --> # 06.09.2022 Binary Classification Results: **Experiment 1** **Model information**: Model name: DenseNet (based on: Densely Connected Convolutional Networks [LINK](https://arxiv.org/pdf/1608.06993.pdf)) Number of Parameters: 11.2 M Dropout = 0.1 (without any dropout for this experiment) Loss: Binary Cross Entropy (WithLogitsLoss) [LINK](https://pytorch.org/docs/stable/generated/torch.nn.BCEWithLogitsLoss.html#torch.nn.BCEWithLogitsLoss) Optimizer: Adam, Learning rate=1e-5 [LINK](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html#torch.optim.Adam) Batch size: 2 cases Related libraries: Pytorch, MONAI **Data Information**: - Training Size: 255 cases - Patches 64 * 64 * 64 - 50% Contains airway, 50% not airways - Validation Size: 45 cases - Patches 64 * 64 * 64 - 50% Contains airway, 50% not airways (Most important) Preprocessing transforms: - Spacing: Resample input image into the specified pixdim. 'PIXEL_VOL_SIZE' = (1.5, 1.5, 2) - Intensity Range: Apply specific intensity scaling to the whole numpy array. Scaling from [a_min, a_max]=[-1000,200] to [b_min, b_max]=[0,1] with clipping option. - Divisible padding: Pad the input data, so that the spatial sizes are divisible by k=64. - Patchify: Extract all the patches sweeping the entire image in a row-major sliding-window manner with possible overlaps. It can sort the patches and return all or a subset of them (In our case, we are extracting patches that contains airways and non-airways, equally). Training Loss Curve: ![](https://i.imgur.com/bDIi68n.png) Accuracy Loss Curve: ![](https://i.imgur.com/83h6Dra.png) Plot Notes: in the last epoch, the training loss experience a gradual decrease in comparison to validation loss which did not change so much. The degradation of the accuracy shows that our model is overfitting on the training set. **Experiment 2** Running on GPU1, device=cuda:3 **Model information**: Model name: DenseNet (based on: Densely Connected Convolutional Networks [LINK](https://arxiv.org/pdf/1608.06993.pdf)) Number of Parameters: 11.2 M Dropout = 0.1 Loss: Binary Cross Entropy (WithLogitsLoss) [LINK](https://pytorch.org/docs/stable/generated/torch.nn.BCEWithLogitsLoss.html#torch.nn.BCEWithLogitsLoss) Optimizer: Adam, Learning rate=1e-5 [LINK](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html#torch.optim.Adam) Batch size: 2 cases Related libraries: Pytorch, MONAI **Data Information**: - Training Size: 255 cases - Patches 64 * 64 * 64 - 50% Contains airway, 50% not airways - Validation Size: 45 cases - Patches 64 * 64 * 64 - 50% Contains airway, 50% not airways (Most important) Preprocessing transforms: - Spacing: Resample input image into the specified pixdim. 'PIXEL_VOL_SIZE' = (1.5, 1.5, 2) - Intensity Range: Apply specific intensity scaling to the whole numpy array. Scaling from [a_min, a_max]=[-1000,200] to [b_min, b_max]=[0,1] with clipping option. - Divisible padding: Pad the input data, so that the spatial sizes are divisible by k=64. - Patchify: Extract all the patches sweeping the entire image in a row-major sliding-window manner with possible overlaps. It can sort the patches and return all or a subset of them (In our case, we are extracting patches that contains airways and non-airways, equally). Training Loss Curve: will be added soon... Accuracy Loss Curve: will be added soon... # 05.09.2022 Binary Classification Initial (GoogleColab) Results: **Model information**: Model name: DenseNet (based on: Densely Connected Convolutional Networks [LINK](https://arxiv.org/pdf/1608.06993.pdf)) Number of Parameters: 11.2 M Dropout = 0.1 Loss: Binary Cross Entropy (WithLogitsLoss) [LINK](https://pytorch.org/docs/stable/generated/torch.nn.BCEWithLogitsLoss.html#torch.nn.BCEWithLogitsLoss) Optimizer: Adam, Learning rate=1e-5 [LINK](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html#torch.optim.Adam) Batch size: 2 cases Related libraries: Pytorch, MONAI, TorchIO, PytorchLightning **Data Information**: - Training Size: 8 cases - 202 Patches 64 * 64 * 64 - 101 Contains airway, 101 not airways - Validation Size: 2 cases - 44 Patches 64 * 64 * 64 - 22 Contains airway, 22 not airways (Most important) Preprocessing transforms: - Spacing: Resample input image into the specified pixdim. 'PIXEL_VOL_SIZE' = (1.5, 1.5, 2) - Intensity Range: Apply specific intensity scaling to the whole numpy array. Scaling from [a_min, a_max]=[-1000,200] to [b_min, b_max]=[0,1] with clipping option. - Divisible padding: Pad the input data, so that the spatial sizes are divisible by k=64. - Patchify: Extract all the patches sweeping the entire image in a row-major sliding-window manner with possible overlaps. It can sort the patches and return all or a subset of them (In our case, we are extracting patches that contains airways and non-airways, equally). Training Loss Curve: ![](https://i.imgur.com/X0VbzRa.png) Plot notes: - The final loss of validation set is less than training loss; There are many possiblities: - The most common reason is regularization (e.g., dropout), since it applies during training, but not during validation & testing. If we add the regularization loss to the validation loss, things look much different. - The training loss is measured ***during*** each epoch, while the validation loss is measured ***after*** each epoch, so on average the training loss is measured ½ an epoch earlier. If we shift it by ½ an epoch to the left (where is should be), things again look much different. - Perhaps the val set is easier than the training set! Which can be really true in our case since we have 2 cases in validation set and 8 cases in training set. - Overfitting: We should see the results on the whole dataset to write about it. Accuracy Loss Curve: ![](https://i.imgur.com/5vce3ME.png) val_accu = [0.5000,0.7045,0.7500,0.8636,0.9545] Patch_examples with Airways: ![](https://i.imgur.com/JrpWP9m.png) Patch_examples without Airways: ![](https://i.imgur.com/DZXOE5q.png) A lot of non-airway patches are located on the edge (with possible padding) # 03.09.2022 Meeting: My ideas for further directions # 02.09.2022 - Implement the torchio based pipeline. The following has changed: - Dataloading has changed (Now we are using lazy loading to use the memory with maximum efficiency and torchio.QUEUE for maximizing the performance) ![](https://i.imgur.com/OIe2hoT.jpg) - Randomly patchifying the volumes and uniformly sample from those cases. # 01.09.2022 <!-- # 31.08.2022 # 30.08.2022 # 26.08.2022 --> # 25.08.2022 Distributed Computing pipeline for 3D classification # 24.08.2022 Distributed Computing pipeline for 3D classification # 23.08.2022 - Working on binary classification of 3D patches: - The pytorch training pipeline is implemented; however due to the limited memory we can not process the whole volume at the same time. I am working on using Torch Lighnening library to use the multiple GPUs for better computing. # 22.08.2022 - Implementing the pytorch pipeline for binary classification of 3d Patches # 19.08.2022 - Algorithm Unrolling paper will be added soon. # 18.08.2022 - Algorithm Unrolling paper *paper to read: https://arxiv.org/pdf/2103.10504.pdf # 17.08.2022 - Proximal gradient method and ISTA algorithm mathematical explanation - Algorithm Unrolling paper # 16.08.2022 - ADMM algorithm description on SPORCO - PGM algorithm description on SPORCO - Comparing the speed and performance of ADMM and PGM on one volume - Running experiments and debugging # 12.08.2022 Pipeline diagram with explanation: ![](https://i.imgur.com/dx1Qthm.png) Convoltuonal Dictionary Learning Mathematical details: Convoltuonal Sparse Coding Mathematical details: # 11.08.2022 Some of the patches that we used to learn atoms: ![](https://i.imgur.com/igaAUoD.png) ![](https://i.imgur.com/vLENHLK.png) ![](https://i.imgur.com/hhlGfsx.png) ![](https://i.imgur.com/UZWeFdO.png) ![](https://i.imgur.com/Mvp5Yao.png) ![](https://i.imgur.com/eB1YhUO.png) ![](https://i.imgur.com/p4eQvAy.png) ![](https://i.imgur.com/TXaMAx8.png) ![](https://i.imgur.com/NqCMFW7.png) ![](https://i.imgur.com/KgDslix.png) --- Dictionary (after augmentation): ![](https://i.imgur.com/skAe4o0.png) # 10.08.2022 re-arrange the code for ConvDictLearning on patches from multiple slices of a case and ConvSparseCoding 60 cases. The code is running, results will be added soon. # 09.08.2022 Our pipeline mathematical explanation # 08.08.2022 Just internal lung regions: ![](https://i.imgur.com/nHFFj9Q.gif) Link to the nii file: Upload to drive Lung surface removed: ![](https://i.imgur.com/5JyeR8Z.gif) Link to the nii file: Upload to drive # 05.08.2022 Meeting notes: - Looking for a solution to exclude ribs in the sparse representations DONE - Add test data from other slices to check the atoms' augmentation performance DONE - Write a full mathematical + pseudo code explanation of the pipeline and the techniques DONE - One page summary of my ideas for further steps or close papers - Parallel computing using CPUs # 04.08.2022 **Current pipeline:** - Convolutional Dictionary Learning and Convolutional Sparse Coding pipeline for airway patches with different configurations     - Patch size     - Atoms and dictionary size     - Atoms pruning     - Atoms augmentation     - Clipping and patches normalization     - Dictionary updating algorithms     - Few-shot dictionary learning Vs. learning on a large dataset of patches     - Transformation - Validated the pipeline on MNIST - The PSNR metric shows acceptable results and empirically shows that we can represent at least the first generation of airways **Current problems:** - We are learning atoms for all the internal structures of the lung, not just airways! - In complex regions and when we have airways close to other low-contrast areas, the sparse coding is problematic for our algorithm. - The speed of the pipeline (CPU-based pipeline) ~30 seconds per slice for sparse coding **Urgent solutions:** - Implementing the PyTorch-based ConvDictLearning and ConvSparseCoding (hope for a much faster inference time) - Multi-layer ConvDictLearning and ConvSparseCoding (PyTorch-based) and (recognize and distinguish better the internal structures of the lungs, especially in complicated regions) ## ATM22 challenge: Note 1: The integration of our sparse coding pipeline and any segmentation method is something that we need to think of and with our current inference time of sparse coding it's not feasible to combine both ideas. Note 2: If we only learn on patches that contain airways, the model won't learn to discriminate between airway and non-airway regions properly.  Note 3: The challenge is open-call (the challenge opens for new submissions after the conference deadline).  # 03.07.2022 Clipping + Transformation results: Using a variant of Tanh function (np.exp(x) - np.exp(-20*x)) / (np.exp(x) + np.exp(-20*x)) ![](https://i.imgur.com/qYqhY0G.png) Dictionary: ![](https://i.imgur.com/bOo4ASi.png) Patches: ![](https://i.imgur.com/DNjXXCx.png) Reconstruction PSNR: 27.93dB <!-- Convolutional Sparse Coding: 5e-2 ![](https://i.imgur.com/JFdxmrA.png) Slice 270: ![](https://i.imgur.com/stYrXVM.png) Reconstruction PSNR: 36.79dB Slice 300: ![](https://i.imgur.com/fNVSxIu.png) Reconstruction PSNR: 37.40dB --> Convolutional Sparse Coding: lambda 5e-1 ![](https://i.imgur.com/GjjKffZ.png) Slice 270: ![](https://i.imgur.com/stYrXVM.png) Reconstruction PSNR: 26.07dB Slice 300: ![](https://i.imgur.com/j7qixaZ.png) Reconstruction PSNR: 26.84dB # 27.07.2022 Toolkit analysis for centerlines: The tool is not free! http://vmtklab.orobix.com/ # 26.07.2022 The results of Dictionary atoms checking: ![](https://i.imgur.com/H7q3Bn1.png) Keeping only atoms that at least have one non-zero coefficients: ![](https://i.imgur.com/B5tmKgh.png) **Augmenting** The atoms by rotating them ![](https://i.imgur.com/peLAbfr.png) **Convolutional Sparse Coding** with augmented dictionaries: ![](https://i.imgur.com/gRXJZz4.png) ![](https://i.imgur.com/DeEtqap.png) Reconstruction PSNR: **34.14dB** **Convolutional Sparse Coding** with learned dictionaries: ![](https://i.imgur.com/IAV1qed.png) ![](https://i.imgur.com/h4ArFJT.png) Reconstruction PSNR: **33.77dB** # 25.07.2022 points to discuss: - The difference between circular and non-round airways - Detecting airways in complicated areas - Near other tissues - Different shapes of airways - Contrast Adjustments # 22.07.2022 *Add other experiments here !!! including the examples that are already sent by email. Experiment 1: Whole 2d Slice Convolutional Sparse Coding with previously learned dictionary Reconstruction PSNR: **33.54dB** <!-- Good thing is that we can learn such a dictionary on only a few patches. learn dictionary for each patient --> # 20.07.2022 **Test Learned dictionaries on lung parenchyma:** (Running) Experiment 10: Train the algorithm on only 8 (64*64) patches. dictionary size: (3, 3, 36) lambda = 0.2 Max Iterations: 2000 ![](https://i.imgur.com/BDrF99G.png) Column 1: Original Image Column 2: Airway Mask Column 3: Highpass component Column 4: Lowpass component Column 5: Reconstructed Patch (Without lowpass component) ![](https://i.imgur.com/TeqQwFg.png) <!-- Reconstruction (comparing to Highpass component) PSNR: **62.01dB** --> Experiment 11: Train the algorithm on only 8 (64*64) patches. dictionary size: (3, 3, 72) lambda = 0.2 Max Iterations: 2000 ![](https://i.imgur.com/VeSBsHM.png) ![](https://i.imgur.com/TtPccxb.png) <!-- Reconstruction (comparing to Highpass component) PSNR: **62.97dB** --> Experiment 12: Train the algorithm on only 8 (64*64) Normalized patches. dictionary size: (3, 3, 36) lambda = 0.2 Max Iterations: 2000 ![](https://i.imgur.com/tcTGwqi.png) ![](https://i.imgur.com/EehFUmq.png) <!-- Reconstruction (comparing to Highpass component) PSNR: **22.48dB** --> Experiment 13: Train the algorithm on only 8 (64*64) Normalized patches. dictionary size: (3, 3, 72) lambda = 0.2 Max Iterations: 2000 ![](https://i.imgur.com/ZmpWUVn.png) ![](https://i.imgur.com/Hlpyz6v.png) <!-- Reconstruction (comparing to Highpass component) PSNR: **22.51dB** --> Experiment 14: Train the algorithm on only 8 (64*64) Normalized patches. dictionary size: (5, 5, 36) lambda = 0.2 Max Iterations: 2000 ![](https://i.imgur.com/Gz8i1JP.png) ![](https://i.imgur.com/Bvbjwd0.png) Reconstruction (comparing to Highpass component) PSNR: **26.09dB** Experiment 15: Train the algorithm on only 8 (64*64) Normalized patches. dictionary size: (5, 5, 72) lambda = 0.2 Max Iterations: 2000 ![](https://i.imgur.com/Jdfsz2H.png) ![](https://i.imgur.com/6xRVxUC.png) Reconstruction (comparing to Highpass component) PSNR: **26.20dB** Experiment 16: Train the algorithm on only 8 (64*64) Normalized patches. dictionary size: (5, 5, 18) lambda = 0.2 Max Iterations: 10000 ![](https://i.imgur.com/34YRvXi.png) ![](https://i.imgur.com/WIXYzhx.png) Reconstruction (comparing to Highpass component) PSNR: **25.98dB** <!-- Possible reason (brainstorming): 1. Complexity of Airway Patches 2. On MNIST, the range of digits pixel values are not so diverse. and the numbers are located in the middle of the patch without any difference in background color and any surrounding areas, while in the airway patches the diversity of shapes of the airways and values are way more than MNIST digits. The surrounding areas and close structures are much more diverse compared to the MNIST dataset. --> # 19.07.2022 **Experiments on few patches with following augmentations:** - Sample 25 patches - Adding Gaussian White Noise - Rotation - Flipping - Patch size 32*32 Experiment 1: Size of images: 32*32 Sample 50 images from the dataset. Atom and Dictionary size: (3, 3, 36) lambda: 0.2 maximum iteration: 10000 Normalization: False ![](https://i.imgur.com/CJeodOO.png) ![](https://i.imgur.com/lcWVQa8.png) Reconstruction PSNR: **8.19dB** --- --- Experiment 2: Size of images: 32*32 Sample 50 images from the dataset. Atom and Dictionary size: (3, 3, 36) lambda: 0.2 maximum iteration: 5000 Normalization: True ![](https://i.imgur.com/mPLddCG.png) ![](https://i.imgur.com/TlDVrSn.png) Reconstruction PSNR: 6.69dB <!-- *According to image compression community Acceptable values for wireless transmission quality loss are considered to be about 20 dB to 25 dB --> --- --- Experiment 3: Size of images: 32*32 Sample 50 images from the dataset. Atom and Dictionary size: (3, 3, 36) lambda: 0.2 maximum iteration: 10000 Normalization: True ![](https://i.imgur.com/9hEEV6f.png) ![](https://i.imgur.com/tT2OmNs.png) Reconstruction PSNR: **6.69dB** We don't have noticeable gain for +5000 iterations --- --- # 18.07.2022 **Experiments on MNIST:** (50 samples) Experiment 1: Best result Size of images: 28*28 Sample 50 images from the dataset. Atom and Dictionary size: (3, 3, 36) lambda: 0.2 maximum iteration: 5000 ![](https://i.imgur.com/XsDpQmt.png) ![](https://i.imgur.com/8dgAm3i.png) Average Reconstruction PSNR: **29.93dB** --- --- Experiment 2: Size of images: 28*28 Sample 50 images from the dataset. Atom and Dictionary size: (5, 5, 36) lambda: 0.2 maximum iteration: 5000 ![](https://i.imgur.com/4bbUE50.png) ![](https://i.imgur.com/1gDWDpn.png) Average Reconstruction PSNR: **15.74dB** --- --- Experiment 3: Size of images: 28*28 Sample 50 images from the dataset. Atom and Dictionary size: (7, 7, 36) lambda: 0.2 maximum iteration: 5000 ![](https://i.imgur.com/mLNYYlv.png) ![](https://i.imgur.com/HpgmuHH.png) Average Reconstruction PSNR: **16.61dB** --- --- Experiment 4: Size of images: 28*28 Sample 50 images from the dataset. Atom and Dictionary size: (9, 9, 36) lambda: 0.2 maximum iteration: 5000 ![](https://i.imgur.com/eXqnlAX.png) ![](https://i.imgur.com/ezN8NAA.png) Average Reconstruction PSNR: **16.88dB** --- --- Experiment 5: Size of images: 28*28 Sample 50 images from the dataset. Atom and Dictionary size: (11, 11, 36) lambda: 0.2 maximum iteration: 5000 ![](https://i.imgur.com/tqXL48D.png) ![](https://i.imgur.com/bx7K22B.png) Average Reconstruction PSNR: 16.97dB > > **Conclusions:** > 1. Larger atom size has longer training time > 2. Larger atom size requires more number of itreration to converge Notes: the dictionary size of (x,x,72), (x,x,144) also has been tested but didn't show major difference in performance. --- This week goals: - we may need to consider **wavelet** - Document everything and implement the pytorch version --- Dataset Size: (32,32,1000) # 17.07.2022 PGM method: **Experiment Setup: Dictionary Size: (7,7,24), (9,9,24), (11,11,24), lambda: 0.2, Normalized patches: False** 20% airways ![](https://i.imgur.com/MPqbgIM.png) ![](https://i.imgur.com/GsJfi7Y.png) 40% airways ![](https://i.imgur.com/H4kFOce.png) ![](https://i.imgur.com/GI4aNpW.png) # 16.07.2022 <!-- Do I need this??? **Experiment 3 Augmented: Dictionary Size: 11,11,24, lambda: 0.2, Normalized patches: True** ![](https://i.imgur.com/hO19hPe.png) ![](https://i.imgur.com/3POA9Wq.png) --> # 15.07.2022 **Experiment Setup: Dictionary Size: 11,11,24, lambda: 0.6, Normalized patches: False** Results: Col 1: Original Image (Normalized True) Col 2: Original Mask Col 3: Sparse Representation (lambda = 0.2) Col 4: Reconstruction Col 5: Reconstruction + lowpass patch **11. Dictionary for patches that contains 20% airways:** ![](https://i.imgur.com/U67bGWa.png) Results: ![](https://i.imgur.com/KIcOWuN.png) **12. Dictionary for patches that contains 40% airways:** ![](https://i.imgur.com/TvpUuKA.png) Results: ![](https://i.imgur.com/fdHPUzw.png) **Experiment Setup: Dictionary Size: 11,11,24, lambda: 0.4, Normalized patches: True** Results: Col 1: Original Image (Normalized False) Col 2: Original Mask Col 3: Sparse Representation (lambda = 0.2) Col 4: Reconstruction Col 5: Reconstruction + lowpass patch **9. Dictionary for patches that contains 20% airways:** ![](https://i.imgur.com/laILQZj.png) Results: ![](https://i.imgur.com/bYubJOz.png) **10. Dictionary for patches that contains 40% airways:** ![](https://i.imgur.com/QWQX3qj.png) Results: ![](https://i.imgur.com/CZIN1bS.png) # 14.07.2022 **Experiment Setup: Dictionary Size: 11,11,24, lambda: 0.6, Normalized patches: Faslse** Results: Col 1: Original Image Col 2: Original Mask Col 3: Sparse Representation (lambda = 0.2) Col 4: Reconstruction Col 5: Reconstruction + lowpass patch **7. Dictionary for patches that contains 20% airways:** ![](https://i.imgur.com/4moie7k.png) Results: ![](https://i.imgur.com/2GY1vt7.png) **8. Dictionary for patches that contains 40% airways:** ![](https://i.imgur.com/H84LuF3.png) Results: ![](https://i.imgur.com/P6d36kW.png) **Experiment Setup: Dictionary Size: 11,11,24, lambda: 0.4, Normalized patches: True** Results: Col 1: Original Image (Normalized False) Col 2: Original Mask Col 3: Sparse Representation (lambda = 0.2) Col 4: Reconstruction Col 5: Reconstruction + lowpass patch **5. Dictionary for patches that contains 20% airways:** ![](https://i.imgur.com/wA4aPfP.png) Results: ![](https://i.imgur.com/X7Te5SG.png) **6. Dictionary for patches that contains 40% airways:** ![](https://i.imgur.com/aZHKruV.png) Results: ![](https://i.imgur.com/ggBpkm2.png) # 13.07.2022 **Experiment Setup: Dictionary Size: 11,11,24, lambda: 0.2, Normalized patches: False** Results: Col 1: Original Image Col 2: Original Mask Col 3: Sparse Representation (lambda = 0.2) Col 4: Reconstruction Col 5: Reconstruction + lowpass patch **3. Dictionary for patches that contains 20% airways:** ![](https://i.imgur.com/4moie7k.png) Results: ![](https://i.imgur.com/2GY1vt7.png) **4. Dictionary for patches that contains 40% airways:** ![](https://i.imgur.com/H84LuF3.png) Results: ![](https://i.imgur.com/P6d36kW.png) **Experiment Setup: Dictionary Size: 11,11,24, lambda: 0.2, Normalized patches: True** Results: Col 1: Original Image Col 2: Original Mask Col 3: Sparse Representation (lambda = 0.2) Col 4: Reconstruction Col 5: Reconstruction + lowpass patch **1. Dictionary for patches that contains 20% airways:** ![](https://i.imgur.com/wA4aPfP.png) Results: ![](https://i.imgur.com/X7Te5SG.png) **2. Dictionary for patches that contains 40% airways:** ![](https://i.imgur.com/aZHKruV.png) Results: ![](https://i.imgur.com/ggBpkm2.png) # 12.07.2022 Dictionary for patches that contains 40% airways: ![](https://i.imgur.com/TEkofaB.png) Dictionary for patches that contains 20% airways: ![](https://i.imgur.com/GjRZs9H.png) Results: Col 1: Original Image Col 2: Original Mask Col 3: Sparse Representation (lambda = 0.2) Col 4: Reconstruction Col 5: Reconstruction + lowpass patch ![](https://i.imgur.com/vvOHyX5.png) Dictionary Augmentation: ![](https://i.imgur.com/ZaGXcRQ.png) Results: Col 1: Original Image Col 2: Original Mask Col 3: Sparse Representation (lambda = 0.2) Col 4: Reconstruction Col 5: Reconstruction + lowpass patch ![](https://i.imgur.com/cBbv5OM.png) # 07.07.2022 Dictionary for patches that contains >0% airways: ![](https://i.imgur.com/IhAeQb3.png) Results: ![](https://i.imgur.com/eapL3lV.png)