Semantic Segmentation - It label the pixels of a road in images using a Fully Convolutional Network (FCN).
pip install opencv-python opencv-contrib-python scipy==1.2.0 Pillow matplotlib tensorflow-gpu numpy colored
The project start loading a vgg model so implements an FCN - Fully Convolutional Network
More details about how VGG16 is used in this archtechture to converte it to a fully convolutional network, you can read 'this paper'.
Make sure you have the following is installed:
The project will download the Kitti Road dataset dataset from here. It will extract the files in data
folder. This will create the folder data_road
with all the training a test images.
Add images in data/data_road/training/
- gt_image_2/um_lane_000000.png
- image_2/um_000000.png
Run the following command to run the project:
python main.py
python main.py -e 25 -i './data/data_road/training/image_2/*.png' -l './data/data_road/training/gt_image_2/*_road_*.png' -n 2
python main.py -m model/model.ckpt --pred_data_from zed --disable_gpu
python main.py -m model/model.ckpt -V teste.png --pred_data_from image
python main.py -m model/model.ckpt -V teste.mp4 --pred_data_from video
it will run the Neural network with default parameter values, to know more, type python main.py -h
Usage: main.py [options]
Options:
-h, --help show this help message and exit
-i GLOB_TRAINIG_IMAGES_PATH, --glob_trainig_images_path=GLOB_TRAINIG_IMAGES_PATH
Path where is yours images to train the model. eg:
./data/data_road/training/image_2/*.png'
-l GLOB_LABELS_TRAINIG_IMAGE_PATH, --glob_labels_trainig_image_path=GLOB_LABELS_TRAINIG_IMAGE_PATH
Path where is yours label images to train the model.
eg: ./data/data_road/training/gt_image_2/*_road_*.png
-r LEARN_RATE, --learn_rate=LEARN_RATE
The model learn rate | Default=9e-5
-n NUM_CLASSES, --num_classes=NUM_CLASSES
Number of classes in your dataset | Default value = 2
-e EPOCHS, --epochs=EPOCHS
Number of epochs that FCN will train | Default=25
-b BATCH_SIZE, --batch_size=BATCH_SIZE
Number of batch size for each epoch. | Default=4
-t DATA_PATH, --data_path=DATA_PATH
Training data path. | Default='data_road/training'
-p LOG_PATH, --log_path=LOG_PATH
Path to save the tensorflow logs to TensorBoard |
Default='.'
-v VGG_DIR, --vgg_dir=VGG_DIR
Path to dowloand vgg pre trained weigths. |
Default='./data/vgg'
-g GRAPH_VISUALIZE, --graph_visualize=GRAPH_VISUALIZE
create a graph image of the FCN archtecture. |
Default=False
-m path_data, --path_model
Load a model, to predict a data. |
Default=False
-V PATH_DATA, --path_data", Path to predict a data. |
Default= ''
--pred_data_from PRED_DATA_FROM, Choose a type predict [video, image, zed] |
Default=video
--disable_gpu DISABLE_GPU, Disable predict by GPU
Open this link