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:
1 parent
19e2482458
commit
1c8464e199
4 files changed
+13
-13
No files matched your search
+2
-2
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user