当前位置: 首页>>代码示例>>Python>>正文


Python io.data_dir_path函数代码示例

本文整理汇总了Python中menpo.io.data_dir_path函数的典型用法代码示例。如果您正苦于以下问题:Python data_dir_path函数的具体用法?Python data_dir_path怎么用?Python data_dir_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了data_dir_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_import_images_are_ordered_and_unduplicated

def test_import_images_are_ordered_and_unduplicated():
    # we know that import_images returns images in path order
    imgs = list(mio.import_images(mio.data_dir_path()))
    imgs_filenames = [i.path.stem for i in imgs]
    print(imgs_filenames)
    exp_imgs_filenames = ['breakingbad', 'einstein', 'lenna', 'menpo_thumbnail', 'takeo', 'tongue']
    assert exp_imgs_filenames == imgs_filenames
开发者ID:dvdm,项目名称:menpo,代码行数:7,代码来源:io_import_test.py

示例2: test_import_lazy_list

def test_import_lazy_list():
    from menpo.base import LazyList
    data_path = mio.data_dir_path()
    ll = mio.import_images(data_path)
    assert isinstance(ll, LazyList)
    ll = mio.import_landmark_files(data_path)
    assert isinstance(ll, LazyList)
开发者ID:dvdm,项目名称:menpo,代码行数:7,代码来源:io_import_test.py

示例3: test_ioinfo

def test_ioinfo():
    # choose a random asset (all should have it!)
    img = pio.import_builtin_asset('einstein.jpg')
    path = pio.data_path_to('einstein.jpg')
    assert(img.ioinfo.filepath == path)
    assert(img.ioinfo.filename == 'einstein')
    assert(img.ioinfo.extension == '.jpg')
    assert(img.ioinfo.dir == pio.data_dir_path())
开发者ID:ikassi,项目名称:menpo,代码行数:8,代码来源:io_test.py

示例4: test_path

def test_path():
    # choose a random asset (all should have it!)
    img = mio.import_builtin_asset('einstein.jpg')
    path = mio.data_path_to('einstein.jpg')
    assert(img.path == path)
    assert(img.path.stem == 'einstein')
    assert(img.path.suffix == '.jpg')
    assert(img.path.parent == mio.data_dir_path())
    assert(img.path.name == 'einstein.jpg')
开发者ID:dvdm,项目名称:menpo,代码行数:9,代码来源:io_import_test.py

示例5: test_shuffle_kwarg_true_calls_shuffle

def test_shuffle_kwarg_true_calls_shuffle(mock):
    list(mio.import_images(mio.data_dir_path(), shuffle=True))
    assert mock.called
开发者ID:dvdm,项目名称:menpo,代码行数:3,代码来源:io_import_test.py

示例6: test_import_as_generator

def test_import_as_generator():
    import types
    gen = mio.import_images(mio.data_dir_path(), as_generator=True)
    assert isinstance(gen, types.GeneratorType)
    gen = mio.import_landmark_files(mio.data_dir_path(), as_generator=True)
    assert isinstance(gen, types.GeneratorType)
开发者ID:dvdm,项目名称:menpo,代码行数:6,代码来源:io_import_test.py

示例7: test_import_image

def test_import_image():
    img_path = os.path.join(mio.data_dir_path(), 'einstein.jpg')
    mio.import_images(img_path)
开发者ID:karla3jo,项目名称:menpo,代码行数:3,代码来源:io_test.py

示例8: test_image_paths

def test_image_paths():
    ls = mio.image_paths(mio.data_dir_path())
    assert(len(list(ls)) == 6)
开发者ID:dvdm,项目名称:menpo,代码行数:3,代码来源:io_import_test.py

示例9: test_import_landmark_file

def test_import_landmark_file():
    lm_path = mio.data_dir_path() / 'einstein.pts'
    mio.import_landmark_file(lm_path)
开发者ID:dvdm,项目名称:menpo,代码行数:3,代码来源:io_import_test.py

示例10: test_import_images

def test_import_images():
    imgs = list(mio.import_images(mio.data_dir_path()))
    imgs_filenames = set(i.path.stem for i in imgs)
    exp_imgs_filenames = {'einstein', 'takeo', 'tongue', 'breakingbad', 'lenna',
                          'menpo_thumbnail'}
    assert exp_imgs_filenames == imgs_filenames
开发者ID:dvdm,项目名称:menpo,代码行数:6,代码来源:io_import_test.py

示例11: test_import_image_no_norm

def test_import_image_no_norm():
    img_path = os.path.join(mio.data_dir_path(), 'einstein.jpg')
    im = mio.import_image(img_path, normalise=False)
    assert im.pixels.dtype == np.uint8
开发者ID:csagonas,项目名称:menpo,代码行数:4,代码来源:io_import_test.py

示例12: test_import_auto

def test_import_auto():
    assets_glob = os.path.join(mio.data_dir_path(), '*')
    assets = list(mio.import_auto(assets_glob))
    assert(len(assets) == 6)
开发者ID:karla3jo,项目名称:menpo,代码行数:4,代码来源:io_test.py

示例13: test_import_images

def test_import_images():
    imgs_glob = os.path.join(pio.data_dir_path(), '*')
    imgs = list(pio.import_images(imgs_glob))
    imgs_filenames = set(i.ioinfo.filename for i in imgs)
    exp_imgs_filenames = {'einstein', 'takeo', 'breakingbad', 'lenna'}
    assert(len(exp_imgs_filenames - imgs_filenames) == 0)
开发者ID:ikassi,项目名称:menpo,代码行数:6,代码来源:io_test.py

示例14: test_import_images_zero_max_images

def test_import_images_zero_max_images():
    # different since the conditional 'if max_assets' is skipped,
    # thus all images might be imported.
    list(mio.import_images(mio.data_dir_path(), max_images=0))
开发者ID:dvdm,项目名称:menpo,代码行数:4,代码来源:io_import_test.py

示例15: test_image_paths

def test_image_paths():
    ls = mio.image_paths(os.path.join(mio.data_dir_path(), '*'))
    assert(len(ls) == 5)
开发者ID:karla3jo,项目名称:menpo,代码行数:3,代码来源:io_test.py


注:本文中的menpo.io.data_dir_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。