Commit 8fe06b7b authored by Thomas Grenier's avatar Thomas Grenier
Browse files

update with new values and git subdir

parent aeeecc10
[submodule "keras_unet"]
path = keras_unet
url = https://gitlab.in2p3.fr/thomas.grenier/keras-unet.git
This diff is collapsed.
......@@ -98,13 +98,6 @@
"plt.rcParams[\"figure.figsize\"] = (15,15)\n",
"\n",
"import cv2\n",
"\n",
"# add keras-unet python sources to the path\n",
"if '../' in sys.path: \n",
" print(sys.path)\n",
"else: \n",
" sys.path.append('../')\n",
" print(sys.path)\n",
" \n",
"#prevent unwanted warning \n",
"os.environ[\"TF_CPP_MIN_LOG_LEVEL\"]=\"3\" "
......@@ -146,15 +139,15 @@
"# Network architecture related values \n",
"NBLAYERS_UNET = 5 # <- number of levels [5]\n",
"NBFILTERS_L1_UNET = 16 # <- number of neurons for the first level [32]\n",
"DROPOUT_RATE = 0.0 # 0.0 to 1.0 [0.1]\n",
"DROPOUT_RATE = 0.1 # 0.0 to 1.0 [0.1]\n",
"KERNEL_SIZE = (3,3) # (3,3) (5,5) \n",
"BATCHNORM_ON = False # True or False [True]\n",
"\n",
"CNN_ACTIVATION = 'relu' # relu, elu, selu, LeakyReLU, ...\n",
"\n",
"# Training parameters\n",
"NBEPOCHS = 10 # Nb of Epoch [10]\n",
"BATCH_SIZE = 8 # Number of sample in each batch (4 to 64) [8]\n",
"NBEPOCHS = 20 # Nb of Epoch [10]\n",
"BATCH_SIZE = 16 # Number of sample in each batch (4 to 64) [8]\n",
"NBSTEPS_PER_EPOCH = 50 # nb of batches per epoch (1 to ...) [50] (used for data augmentation)\n",
"NBPATIENCE_EPOCHS = 30 # nb of epoch after a minimum detection before stopping (early stop) [30]"
]
......@@ -196,7 +189,8 @@
"source": [
"import tensorflow as tf\n",
"\n",
"print(tf.__version__)"
"print(tf.__version__)\n",
"print(\"Number of GPUs available : \", len(tf.config.list_physical_devices('GPU')))\n"
]
},
{
......@@ -261,6 +255,14 @@
"nb_train = int( len(train_masks_files) * (1 - VALIDATION_RATIO) )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"__The previous cell should output 717 as training images and 208 as testing images.\n",
"If not, you must check where the data is.__"
]
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -782,8 +784,8 @@
"source": [
"## <span style=\"color:red\"> Questions\n",
"\n",
"- Run 10 more epoches and display curves and results again (... run the cells after §5.3). Are the results better ?\n",
"- And 10 more ? \n",
"- Run 20 more epoches and display curves and results again (... run the cells after §5.3). Are the results better ?\n",
"- And 20 more ? \n",
"\n",
"- Train this network to have a DICE > 0.90. \n",
" - Are the segmentation results convincing on the validation images ? Execute the next 2 cells : evaluation is performed on the test set.\n",
......
This diff is collapsed.
# TP4SS_Segmentation
Illustration of UNet training and testing on 2D images, dedicated to teaching.
01_UNET_TF2_test.ipynb --> understand images organization/loading and inference with a trained model,
01_UNET_TF2_train.ipynb --> train a UNet model
Images are small (resized to 96 x 96), architecture is basic (UNet 2D) with many parameters to modify it (number of filters, number of level, activation, trainig method and parameters, ...), data generator, one to three channels as input.
With the proposed parameters, a first 2 minutes learning using GPU can provide amazing results.
Please, clone this repository with:
`git clone --recurse-submodules https://gitlab.in2p3.fr/thomas.grenier/tp4ss_segmentation.git`
Data are included as .tar.gz file
An already trained network is also available for download in order to start by testing the approach.
No preview for this file type
Subproject commit 345364bd6c05192fbec0a151f46080cc1aebecb0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment