Use pathlib instead of low-level module (#1329)

* Use pathlib instead of low-level module

* Use pathlib instead of low-level module

* Update detect.py

* Update test.py

* reformat

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Khiem DoanandGlenn Jocher authored and GitHub committed 2020-11-10 13:01:19 +01:00
1 parent 19e2482458
commit 1c8464e199
4 files changed
+13 -13

No files matched your search

+2 -2
View File
@@ -6,7 +6,7 @@ Usage:
"""
dependencies = ['torch', 'yaml']
import os
from pathlib import Path
import torch
@@ -29,7 +29,7 @@ def create(name, pretrained, channels, classes):
Returns:
pytorch model
"""
config = os.path.join(os.path.dirname(__file__), 'models', f'{name}.yaml') # model.yaml path
config = Path(__file__).parent / 'models' / f'{name}.yaml' # model.yaml path
try:
model = Model(config, channels, classes)
if pretrained: