• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python io.data_dir_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_mesh_paths

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


示例17: test_import_auto_max_meshes

def test_import_auto_max_meshes():
    assets_glob = os.path.join(mio.data_dir_path(), '*')
    assets = list(mio.import_auto(assets_glob, max_meshes=1))
    assert(sum([isinstance(x, TriMesh) for x in assets]) == 1)
开发者ID:karla3jo,项目名称:menpo,代码行数:4,代码来源:io_test.py


示例18: test_import_landmark_file

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


示例19: test_import_image_no_norm

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


示例20: test_import_images_negative_max_images

def test_import_images_negative_max_images():
    list(mio.import_images(mio.data_dir_path(), max_images=-2))
开发者ID:dvdm,项目名称:menpo,代码行数:2,代码来源:io_import_test.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python io.export_landmark_file函数代码示例发布时间:2022-05-27
下一篇:
Python image.MaskedImage类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap