Skip to content

Commit

Permalink
init update
Browse files Browse the repository at this point in the history
  • Loading branch information
Voldemort108X committed Jul 30, 2021
1 parent 6ae88e8 commit c3fbe88
Show file tree
Hide file tree
Showing 4 changed files with 341 additions and 27 deletions.
75 changes: 56 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,78 @@
}
```
## Dataset
Please refer to challenge website [[link]](https://zmiclab.github.io/projects/myops20/) for dataset access.
Please refer to challenge website [[link]](https://zmiclab.github.io/projects/myops20/) for dataset access. The dataset contains three folders: train25, train25_myops_gd, test20.

## Environment
1. UNet:

```
conda env create -f myops_unet.yml
```
2. Mask-RCNN and UNet++:
```
conda env create -f myops_mrcnn_unetpp.yml
```
## Default directory structure

## Default files
├── Data
| ├── Original_data # Place the downloaded dataset here
| | ├── train25
| | ├── train25_myops_gd
| | ├── test20
├── mask_rcnn_coco.h5 # Downloaded pre-trained mask_rcnn weights
├── config.py
├── data_creator.py
├── ...


## Setup
1. Preprocessing
- Extract dataset to 2D slices
1. Data creator including random warping augmentation
```
python data_creator.py
```

2. Train networks
- Train UNet for LV_BP, RV_BP, LV_NM, LV_ME, LV_MS blocks
```
python data_creator.py
python train_UNet.py
```
- Train Mask-RCNN for LV_ME and LV_MS blocks
- Download pretrained mask_rcnn_coco.h5 at [[here]](https://github.com/matterport/Mask_RCNN/releases) and place it in the current folder.
- Train Mask-RCNN for LV_ME block
```
python train_MaskRCNN.py --mode 'LV_ME'
```
- Train Mask-RCNN for LV_MS block
```
python train_MaskRCNN.py --mode 'LV_MS'
```
- Train UNet++ for LV_ME and LV_MS blocks
```
python train_UNetplusplus.py
```

2. Train networks
- Train UNet for
- Train Mask-RCNN
- Download mrcnn_coco.h5
-
- Train UNet++ for

3. Test networks:
- Test UNet
```
python test_UNet.py
```
- Test Mask-RCNN
- Test UNet++

4. Post-processing and linear decoder:
- Post processing
- Test LV_ME block
```
python test_MaskRCNN.py --mode 'LV_ME'
```
- Test LV_MS block
```
python test_MaskRCNN.py --mode 'LV_MS'
```
- Test UNet++
```
python post_processing.py
python test_UNetplusplus.py
```

4. Post-processing and linear decoder:
```
python post_processing.py
```
## Acknowledgement
1. Please cite the official Mask-RCNN and UNet++ implementations if you use them:
- Mask-RCNN: https://github.com/matterport/Mask_RCNN
Expand Down
8 changes: 0 additions & 8 deletions helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,29 +235,21 @@ def func_saveTrainingDataIntoSlices(destPath, train_inputs, train_labels, mode):
np.save(os.path.join(destPath_label, str(i+1)+'.npy'), train_labels[i])

def func_createLabelToMask(label,myo_type):

#print(type(label))
#print(label.shape)
size_x,size_y = label.shape
mask = np.zeros(shape=(size_x,size_y))

#indices = [(row,col.index(class_values[i])) for row, col in enumerate(list(label)) if class_values[i] in row]
if myo_type == 'LV_MS' or myo_type == 'BG':
indices = np.where(label==class_values_mrcnn_dict[myo_type])
x = indices[0]
y = indices[1]
for j in range(indices[0].shape[0]):
#print(x[j],y[j])
mask[(x[j],y[j])] = 1

return mask

if myo_type == 'LV_ME':
indices = np.where(label==class_values_mrcnn_dict[myo_type])
indices_LVMS = np.where(label==LV_MS)
#print(type(indices[1]))
#print(len(indices))
#print(indices[0].shape)
x = indices[0]
y = indices[1]
for j in range(indices[0].shape[0]):
Expand Down
139 changes: 139 additions & 0 deletions myops_mrcnn_unetpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: myo20_mrcnn
channels:
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _tflow_select=2.1.0=gpu
- absl-py=0.9.0=py36_0
- astor=0.8.0=py36_0
- backcall=0.2.0=py_0
- blas=1.0=mkl
- bzip2=1.0.8=h7b6447c_0
- c-ares=1.15.0=h7b6447c_1001
- ca-certificates=2020.6.24=0
- cairo=1.14.12=h8948797_3
- certifi=2020.6.20=py36_0
- cloudpickle=1.5.0=py_0
- cudatoolkit=10.0.130=0
- cudnn=7.6.5=cuda10.0_0
- cupti=10.0.130=0
- cycler=0.10.0=py36_0
- cytoolz=0.10.1=py36h7b6447c_0
- dask-core=2.20.0=py_0
- dbus=1.13.16=hb2f20db_0
- decorator=4.4.2=py_0
- expat=2.2.9=he6710b0_2
- ffmpeg=4.0=hcdf2ecd_0
- fontconfig=2.13.0=h9420a91_0
- freeglut=3.0.0=hf484d3e_5
- freetype=2.10.2=h5ab3b9f_0
- gast=0.2.2=py36_0
- glib=2.65.0=h3eb4bd4_0
- google-pasta=0.2.0=py_0
- graphite2=1.3.14=h23475e2_0
- grpcio=1.27.2=py36hf8bcb03_0
- gst-plugins-base=1.14.0=hbbd80ab_1
- gstreamer=1.14.0=hb31296c_0
- h5py=2.8.0=py36h61e79e4_3
- harfbuzz=1.8.8=hffaf4a1_0
- hdf5=1.8.20=hba1933b_1
- icu=58.2=he6710b0_3
- imageio=2.9.0=py_0
- intel-openmp=2020.1=217
- ipykernel=5.3.4=py36h5ca1d4c_0
- ipython=7.16.1=py36h5ca1d4c_0
- ipython_genutils=0.2.0=py36_0
- jasper=2.0.14=h07fcdf6_1
- jedi=0.17.1=py36_0
- joblib=1.0.1=pyhd3eb1b0_0
- jpeg=9b=h024ee3a_2
- jupyter_client=6.1.12=pyhd3eb1b0_0
- jupyter_core=4.7.1=py36h06a4308_0
- keras=2.3.1=0
- keras-applications=1.0.8=py_1
- keras-base=2.3.1=py36_0
- keras-preprocessing=1.1.0=py_1
- kiwisolver=1.2.0=py36hfd86e86_0
- lcms2=2.11=h396b838_0
- ld_impl_linux-64=2.33.1=h53a641e_7
- libedit=3.1.20191231=h14c3975_1
- libffi=3.3=he6710b0_2
- libgcc-ng=9.1.0=hdf63c60_0
- libgfortran-ng=7.3.0=hdf63c60_0
- libglu=9.0.0=hf484d3e_1
- libopencv=3.4.2=h765d7f9_1
- libopus=1.3.1=h7b6447c_0
- libpng=1.6.37=hbc83047_0
- libprotobuf=3.12.3=hd408876_0
- libsodium=1.0.18=h7b6447c_0
- libstdcxx-ng=9.1.0=hdf63c60_0
- libtiff=4.1.0=h2733197_1
- libuuid=1.0.3=h1bed415_2
- libvpx=1.7.0=h439df22_0
- libxcb=1.14=h7b6447c_0
- libxml2=2.9.10=he19cac6_1
- lz4-c=1.9.2=he6710b0_0
- markdown=3.1.1=py36_0
- matplotlib=3.2.2=0
- matplotlib-base=3.2.2=py36hef1b27d_0
- mkl=2020.1=217
- mkl-service=2.3.0=py36he904b0f_0
- mkl_fft=1.1.0=py36h23d657b_0
- mkl_random=1.1.1=py36h0573a6f_0
- ncurses=6.2=he6710b0_1
- networkx=2.4=py_1
- numpy=1.18.5=py36ha1c710e_0
- numpy-base=1.18.5=py36hde5b4d6_0
- olefile=0.46=py_0
- opencv=3.4.2=py36h40b0b35_1
- openssl=1.1.1g=h7b6447c_0
- opt_einsum=3.1.0=py_0
- parso=0.7.0=py_0
- pcre=8.44=he6710b0_0
- pexpect=4.8.0=py36_0
- pickleshare=0.7.5=py36_0
- pillow=7.2.0=py36hb39fc2d_0
- pip=20.1.1=py36_1
- pixman=0.40.0=h7b6447c_0
- prompt-toolkit=3.0.5=py_0
- protobuf=3.12.3=py36he6710b0_0
- ptyprocess=0.6.0=py36_0
- py-opencv=3.4.2=py36h765d7f9_1
- pygments=2.6.1=py_0
- pyparsing=2.4.7=py_0
- pyqt=5.9.2=py36h05f1152_2
- python=3.6.10=h7579374_2
- python-dateutil=2.8.1=py_0
- pywavelets=1.1.1=py36h7b6447c_0
- pyyaml=5.3.1=py36h7b6447c_1
- pyzmq=20.0.0=py36h2531618_1
- qt=5.9.7=h5867ecd_1
- readline=8.0=h7b6447c_0
- scikit-image=0.16.2=py36h0573a6f_0
- scipy=1.5.0=py36h0b6359f_0
- setuptools=49.2.0=py36_0
- sip=4.19.8=py36hf484d3e_0
- six=1.15.0=py_0
- sqlite=3.32.3=h62c20be_0
- tensorboard=1.15.0=pyhb230dea_0
- tensorflow=1.15.0=gpu_py36h5a509aa_0
- tensorflow-base=1.15.0=gpu_py36h9dcbed7_0
- tensorflow-estimator=1.15.1=pyh2649769_0
- tensorflow-gpu=1.15.0=h0d30ee6_0
- termcolor=1.1.0=py36_1
- tk=8.6.10=hbc83047_0
- toolz=0.10.0=py_0
- tornado=6.0.4=py36h7b6447c_1
- traitlets=4.3.3=py36_0
- wcwidth=0.2.5=py_0
- webencodings=0.5.1=py36_1
- werkzeug=0.16.1=py_0
- wheel=0.34.2=py36_0
- wrapt=1.12.1=py36h7b6447c_1
- xz=5.2.5=h7b6447c_0
- yaml=0.2.5=h7b6447c_0
- zeromq=4.3.4=h2531618_0
- zlib=1.2.11=h7b6447c_3
- zstd=1.4.4=h0b5b093_3
prefix: /home/xiaoran8/.local/easybuild/software/2017/Core/miniconda3/4.3.27/envs/myo20_mrcnn

Loading

0 comments on commit c3fbe88

Please sign in to comment.