Skip to content

Commit

Permalink
code formatting with black; typos
Browse files Browse the repository at this point in the history
  • Loading branch information
cneud committed Apr 10, 2024
1 parent 5f84938 commit 02b1436
Show file tree
Hide file tree
Showing 8 changed files with 737 additions and 764 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ If you have an image label with height and width of 10, for a binary case the fi
A small sample of training data for binarization experiment can be found here, [Training data sample](https://qurator-data.de/~vahid.rezanezhad/binarization_training_data_sample/), which contains images and lables folders.

### Training , evaluation and output
The train and evaluation folders should contain subfolders of images and labels.
The train and evaluation folders should contain subfolders of images and labels.
The output folder should be an empty folder where the output model will be written to.

### Parameter configuration
Expand All @@ -63,7 +63,7 @@ The output folder should be an empty folder where the output model will be writt
* flip_aug: If ``true``, different types of filp will be applied on image. Type of flips is given with "flip_index" in train.py file.
* blur_aug: If ``true``, different types of blurring will be applied on image. Type of blurrings is given with "blur_k" in train.py file.
* scaling: If ``true``, scaling will be applied on image. Scale of scaling is given with "scales" in train.py file.
* rotation_not_90: If ``true``, rotation (not 90 degree) will be applied on image. Rothation angles are given with "thetha" in train.py file.
* rotation_not_90: If ``true``, rotation (not 90 degree) will be applied on image. Rotation angles are given with "thetha" in train.py file.
* rotation: If ``true``, 90 degree rotation will be applied on image.
* binarization: If ``true``,Otsu thresholding will be applied to augment the input data with binarized images.
* scaling_bluring: If ``true``, combination of scaling and blurring will be applied on image.
Expand All @@ -73,5 +73,3 @@ The output folder should be an empty folder where the output model will be writt
* weighted_loss: If ``true``, this means that you want to apply weighted categorical_crossentropy as loss fucntion. Be carefull if you set to ``true``the parameter "is_loss_soft_dice" should be ``false``
* data_is_provided: If you have already provided the input data you can set this to ``true``. Be sure that the train and eval data are in "dir_output". Since when once we provide training data we resize and augment them and then we write them in sub-directories train and eval in "dir_output".
* dir_train: This is the directory of "images" and "labels" (dir_train should include two subdirectories with names of images and labels ) for raw images and labels. Namely they are not prepared (not resized and not augmented) yet for training the model. When we run this tool these raw data will be transformed to suitable size needed for the model and they will be written in "dir_output" in train and eval directories. Each of train and eval include "images" and "labels" sub-directories.


14 changes: 5 additions & 9 deletions build_model_load_pretrained_weights_and_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,21 @@
from metrics import *




def configuration():
gpu_options = tf.compat.v1.GPUOptions(allow_growth=True)
session = tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(gpu_options=gpu_options))


if __name__=='__main__':
if __name__ == '__main__':
n_classes = 2
input_height = 224
input_width = 448
weight_decay = 1e-6
pretraining = False
dir_of_weights = 'model_bin_sbb_ens.h5'
#configuration()
model = resnet50_unet(n_classes, input_height, input_width,weight_decay,pretraining)

# configuration()

model = resnet50_unet(n_classes, input_height, input_width, weight_decay, pretraining)
model.load_weights(dir_of_weights)
model.save('./name_in_another_python_version.h5')


6 changes: 3 additions & 3 deletions config_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"weighted_loss": false,
"is_loss_soft_dice": false,
"data_is_provided": false,
"dir_train": "/home/vahid/Documents/handwrittens_train/train",
"dir_eval": "/home/vahid/Documents/handwrittens_train/eval",
"dir_output": "/home/vahid/Documents/handwrittens_train/output"
"dir_train": "/train",
"dir_eval": "/eval",
"dir_output": "/output"
}
Loading

0 comments on commit 02b1436

Please sign in to comment.