Ayush Chaurasia commited on
Commit
b18ca31
1 Parent(s): 85b6fdd

use check_file for --data (#3035)

Browse files
Files changed (1) hide show
  1. utils/wandb_logging/wandb_utils.py +3 -3
utils/wandb_logging/wandb_utils.py CHANGED
@@ -9,7 +9,7 @@ from tqdm import tqdm
9
  sys.path.append(str(Path(__file__).parent.parent.parent)) # add utils/ to path
10
  from utils.datasets import LoadImagesAndLabels
11
  from utils.datasets import img2label_paths
12
- from utils.general import colorstr, xywh2xyxy, check_dataset
13
 
14
  try:
15
  import wandb
@@ -54,7 +54,7 @@ def check_wandb_resume(opt):
54
 
55
 
56
  def process_wandb_config_ddp_mode(opt):
57
- with open(opt.data) as f:
58
  data_dict = yaml.safe_load(f) # data dict
59
  train_dir, val_dir = None, None
60
  if isinstance(data_dict['train'], str) and data_dict['train'].startswith(WANDB_ARTIFACT_PREFIX):
@@ -115,7 +115,7 @@ class WandbLogger():
115
  def check_and_upload_dataset(self, opt):
116
  assert wandb, 'Install wandb to upload dataset'
117
  check_dataset(self.data_dict)
118
- config_path = self.log_dataset_artifact(opt.data,
119
  opt.single_cls,
120
  'YOLOv5' if opt.project == 'runs/train' else Path(opt.project).stem)
121
  print("Created dataset config file ", config_path)
 
9
  sys.path.append(str(Path(__file__).parent.parent.parent)) # add utils/ to path
10
  from utils.datasets import LoadImagesAndLabels
11
  from utils.datasets import img2label_paths
12
+ from utils.general import colorstr, xywh2xyxy, check_dataset, check_file
13
 
14
  try:
15
  import wandb
 
54
 
55
 
56
  def process_wandb_config_ddp_mode(opt):
57
+ with open(check_file(opt.data)) as f:
58
  data_dict = yaml.safe_load(f) # data dict
59
  train_dir, val_dir = None, None
60
  if isinstance(data_dict['train'], str) and data_dict['train'].startswith(WANDB_ARTIFACT_PREFIX):
 
115
  def check_and_upload_dataset(self, opt):
116
  assert wandb, 'Install wandb to upload dataset'
117
  check_dataset(self.data_dict)
118
+ config_path = self.log_dataset_artifact(check_file(opt.data),
119
  opt.single_cls,
120
  'YOLOv5' if opt.project == 'runs/train' else Path(opt.project).stem)
121
  print("Created dataset config file ", config_path)