-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed disp bug, adding missing files
- Loading branch information
1 parent
5393944
commit a045815
Showing
4 changed files
with
60 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
Segmentation: | ||
data = | ||
{'data': [num_images, c, h, w], | ||
'im_info': [num_images, 4] (optional)} | ||
label = | ||
{'label': [batch_size, 1] <- [batch_size, c, h, w]} | ||
""" | ||
|
||
import numpy as np | ||
from utils.image import get_segmentation_image, tensor_vstack | ||
|
||
def get_segmentation_test_batch(segdb, config): | ||
""" | ||
return a dict of train batch | ||
:param segdb: ['image', 'flipped'] | ||
:param config: the config setting | ||
:return: data, label, im_info | ||
""" | ||
imgs, seg_cls_gts, segdb = get_segmentation_image(segdb, config) | ||
im_array = imgs | ||
im_info = [np.array([segdb[i]['im_info']], dtype=np.float32) for i in xrange(len(segdb))] | ||
|
||
data = [{'data': im_array[i], | ||
'im_info': im_info[i]} for i in xrange(len(segdb))] | ||
label = [{'label':seg_cls_gts[i]} for i in xrange(len(segdb))] | ||
|
||
return data, label, im_info | ||
|
||
def get_segmentation_train_batch(segdb, config): | ||
""" | ||
return a dict of train batch | ||
:param segdb: ['image', 'flipped'] | ||
:param config: the config setting | ||
:return: data, label, im_info | ||
""" | ||
# assert len(segdb) == 1, 'Single batch only' | ||
assert len(segdb) == 1, 'Single batch only' | ||
|
||
imgs, seg_cls_gts, segdb = get_segmentation_image(segdb, config) | ||
im_array = imgs[0] | ||
seg_cls_gt = seg_cls_gts[0] | ||
|
||
im_info = np.array([segdb[0]['im_info']], dtype=np.float32) | ||
|
||
data = {'data': im_array, | ||
'im_info': im_info} | ||
label = {'label': seg_cls_gt} | ||
|
||
return data, label | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Cython | ||
EasyDict | ||
opencv-python | ||
mxnet-cu80==1.0.0 |