Construct a automatically training and testing framework to evaluate the performance of the model. This framework includes the following modules.
- preprocessing
- random cropping
- image augmentation using imgaug
- model construction
- unet
- deeplab with weights pretrained on pascal VOC
- mrcnn
- evaluation
- official pycocotools
opencv 4.0.0
imgaug 0.2.6
keras 2.2.4
python 3.5
tensorflow 1.11.0
No need to install
usage: run.py [-h] --net NET [--epochs EPOCHS] [--batch_size BATCH_SIZE] [--gpu GPU] [--img_size IMG_SIZE] [--load_weights LOAD_WEIGHTS]
A testing framework for semantic seg.
optional arguments:
-h, --help show this help message and exit
--net NET The type of net work which is either unet, deeplab or custom.
--epochs EPOCHS
--batch_size BATCH_SIZE
--gpu GPU The id of the gpu used when training.
--img_size IMG_SIZE The size of input image
--load_weights LOAD_WEIGHTS
Use old weights or not (named net_imgSize.h5)
python run.py --net deeplab --epochs 1000 --gpu 0 --img_size 192
Train a deeplab model with input image size of 192
python run.py --net unet --epochs 1000 --gpu 0 --img_size 192
Train a unet model with input image size of 192
python run.py --net custom --epochs 1000 --gpu 0 --img_size 192
Train a custom model with input image size of 192
run.py
- constructs models
- uses generator to feed images into models
- use pycocotools to evaluate the result
-
basic_model.py
- unet
- deeplab
for
run.py
to train and evaluate. -
model.py
- custom model
When defining your own model, you should implement class
custom_model
in themodel.py
which acceptsinput_size
which is the input image size andclasses
which is the number of classes to be classified. Class custom_model should return a keras model instance so thatrun.py
could build model from it. -
mrcnn/
again for
run.py
config.py
Use a Config
class to manage the configuration
data.py
contains a generator with imgaug for custom model, unet and deeplab and a dataset reader for mrcnn.
utils.py
contains some utilties that will be used by any file. It contains padding_and_cropping function for inference stage.
Result will be showed on the screen