DeepLab semantic segmentation#1
Conversation
…/tensorflow/models/tree/master/research/deeplab The default model is downloaded if it does not exist the first time. Segmentation takes about 3 seconds on my GPU, 6 on my CPU A demo can be run from the `segmenter.py` file
raviautar
left a comment
There was a problem hiding this comment.
Code looks fine, needs some improvements. When running the code, make sure the latest version of tensorflow-gpu (v1.7.0) is installed
| # Enable this to run on CPU instead of GPU (if GPU is used by default) | ||
| # os.environ['CUDA_VISIBLE_DEVICES'] = '-1' | ||
|
|
||
| def load_model(MODEL_NAME='mobilenetv2_coco_voctrainaug'): |
There was a problem hiding this comment.
Since this is an example script, it seems more appropriate to move this function to the DeeplabModel.py file. This way, we do not have to copy and function every time we create a new model.
| 'xception_coco_voctrainval': 'deeplabv3_pascal_trainval_2018_01_04.tar.gz', | ||
| } | ||
|
|
||
| urllib.request.urlretrieve(_DOWNLOAD_URL_PREFIX + _MODEL_URLS[MODEL_NAME], _TARBALL_PATH) |
There was a problem hiding this comment.
Could you add a folder named models to this directory, since this throws an error if it does not exist.
There was a problem hiding this comment.
Good point, though you can't commit an empty folder. But I'll add a call to create the folder if it doesn't exist
| t0 = time.clock() | ||
|
|
||
| print('running model...') | ||
| resized_im, seg_map = MODEL.run(orignal_im) |
There was a problem hiding this comment.
The resized_im and seg_map do not appear to have the same dimensions as the original image, which will pose problems for us later when finding bounding boxes and cropping out. Could you please make sure this is the case?
There was a problem hiding this comment.
Will do! In the DeeplabModel they are resized to a certain maximum resolution before running the segmentation
…solution and fixed an issue of the models directory not existing before downloading
|
The inconsistent shapes seems to be fixed. The In addition, 2 minor fixes:
|
|
Indentation is fixed, but I don't think |
# Conflicts: # .gitignore
CopiedAdded the DeepLab semantic segmentation model from the notebook of https://github.com/tensorflow/models/tree/master/research/deeplabThe default model is downloaded if it does not exist the first time. Segmentation takes about 3 seconds on my GPU, 6 on my CPU
A demo can be run from the
segmenter.pyfile