Example #1
0
def tfr_properties(root_path, index_path, device):
    import nvidia.dali.tfrecord as tfrec
    features = {
        "image/encoded": tfrec.FixedLenFeature((), tfrec.string, ""),
        "image/class/label": tfrec.FixedLenFeature([1], tfrec.int64, -1)
    }
    inputs = fn.readers.tfrecord(path=root_path,
                                 index_path=index_path,
                                 features=features)
    enc = fn.get_property(inputs["image/encoded"], key="source_info")
    lab = fn.get_property(inputs["image/class/label"], key="source_info")
    if device == 'gpu':
        enc = enc.gpu()
        lab = lab.gpu()
    return enc, lab
Example #2
0
def wds_properties(root_path, device, idx_paths):
    read = fn.readers.webdataset(paths=[root_path],
                                 index_paths=idx_paths,
                                 ext=['jpg'])
    if device == 'gpu':
        read = read.gpu()
    return fn.get_property(read, key="source_info")
Example #3
0
def es_properties(layouts, device):
    num_outputs = len(layouts)

    def gen_data():
        yield np.random.rand(num_outputs, 3, 4, 5)

    inp = fn.external_source(source=gen_data,
                             layout=layouts,
                             num_outputs=num_outputs,
                             batch=False,
                             cycle=True,
                             device=device)
    return tuple(fn.get_property(i, key="layout") for i in inp)
Example #4
0
def file_properties(files, device):
    read, _ = fn.readers.file(files=files)
    if device == 'gpu':
        read = read.gpu()
    return fn.get_property(read, key="source_info")
Example #5
0
def improper_property(root_path, device):
    read = fn.readers.webdataset(paths=[root_path], ext=['jpg'])
    return fn.get_property(read, key=["this key doesn't exist"])
def get_property_pipeline(files):
    data, _ = fn.readers.file(files=files)
    out = fn.get_property(data, key='source_info')

    return out
Example #7
0
 def file_properties(files):
     read, _ = fn.readers.file(files=files)
     return fn.get_property(read, key="source_info")