path
最后更新
luxonis_ml.utils.path函数
parse_manifest_path
Python
1def parse_manifest_path(value: PathType) -> Path:示例
Pycon
1>>> parse_manifest_path("images/cat.jpg").as_posix()
2'images/cat.jpg'
3>>> parse_manifest_path(r"images\\cat.jpg").as_posix()
4'images/cat.jpg'value(PathType): 从清单中读取的路径值。
Path: 解析后的路径。相对 Windows 路径在构建当前平台的Path之前会转换为 POSIX 风格的组件。
path_to_posix
Python
1def path_to_posix(value: PathType) -> str:示例
Pycon
1>>> path_to_posix(Path("images") / "cat.jpg")
2'images/cat.jpg'
3>>> path_to_posix(r"images\\cat.jpg")
4'images/cat.jpg'value(PathType): 要序列化的路径值。
str: POSIX 风格的路径字符串。
resolve_manifest_path
Python
1def resolve_manifest_path(base_dir: Path, value: PathType) -> Path:base_dir(Path): 相对路径解析的目录。value(PathType): 从清单中读取的路径值。
Path: 绝对解析路径。