コード例 #1
0
ファイル: train.py プロジェクト: Welthungerhilfe/cgm-ml
 def py_load_pickle(path, max_value):
     depthmap, targets = pickle.load(open(path.numpy(), "rb"))
     depthmap = preprocess_depthmap(depthmap)
     depthmap = depthmap / max_value
     depthmap = tf.image.resize(
         depthmap, (CONFIG.IMAGE_TARGET_HEIGHT, CONFIG.IMAGE_TARGET_WIDTH))
     targets = preprocess_targets(targets, CONFIG.TARGET_INDEXES)
     return depthmap, targets
コード例 #2
0
def py_load_pickle(path, max_value=7.5):
    path_ = path if isinstance(path, str) else path.numpy()
    depthmap, targets = pickle.load(open(path_, "rb"))
    depthmap = preprocess_depthmap(depthmap)
    depthmap = depthmap / max_value
    depthmap = tf.image.resize(depthmap,
                               (IMAGE_TARGET_HEIGHT, IMAGE_TARGET_WIDTH))
    targets = preprocess_targets(targets, TARGET_INDEXES)
    return depthmap, targets
コード例 #3
0
ファイル: train.py プロジェクト: Welthungerhilfe/cgm-ml
    def py_load_pickle(path, max_value):
        rgbd_tuple, targets = pickle.load(open(path.numpy(), "rb"))
        rgb = rgbd_tuple[0]  # shape: (240, 180, 3)
        if getattr(CONFIG, 'DATASET_IS_BGR', False):
            rgb = rgb[:, :, ::-1]  # BGR -> RGB
        depthmap = rgbd_tuple[1]  # shape: (240, 180)

        rgb = preprocess_depthmap(rgb)
        rgb = rgb / 255.

        depthmap = preprocess_depthmap(depthmap)
        depthmap = depthmap / max_value
        depthmap = tf.expand_dims(depthmap, -1)  # shape: (240, 180, 1)
        rgbd = tf.concat([rgb, depthmap], axis=2)
        rgbd = tf.image.resize(
            rgbd, (CONFIG.IMAGE_TARGET_HEIGHT, CONFIG.IMAGE_TARGET_WIDTH))
        targets = preprocess_targets(targets, CONFIG.TARGET_INDEXES)
        return rgbd, targets