Feng Wang commited on
Commit
0573285
·
1 Parent(s): e23ae72

fix(setup): cpp extension (#1254)

Browse files
setup.py CHANGED
@@ -8,6 +8,7 @@ import sys
8
  TORCH_AVAILABLE = True
9
  try:
10
  import torch
 
11
  except ImportError:
12
  TORCH_AVAILABLE = False
13
  print("[WARNING] Unable to import torch, pre-compiling ops will be disabled.")
@@ -56,7 +57,7 @@ def get_ext_modules():
56
  def get_cmd_class():
57
  cmdclass = {}
58
  if TORCH_AVAILABLE:
59
- cmdclass["build_ext"] = torch.utils.cpp_extension.BuildExtension
60
  return cmdclass
61
 
62
 
 
8
  TORCH_AVAILABLE = True
9
  try:
10
  import torch
11
+ from torch.utils import cpp_extension
12
  except ImportError:
13
  TORCH_AVAILABLE = False
14
  print("[WARNING] Unable to import torch, pre-compiling ops will be disabled.")
 
57
  def get_cmd_class():
58
  cmdclass = {}
59
  if TORCH_AVAILABLE:
60
+ cmdclass["build_ext"] = cpp_extension.BuildExtension
61
  return cmdclass
62
 
63
 
yolox/data/datasets/coco.py CHANGED
@@ -191,7 +191,7 @@ class COCODataset(Dataset):
191
  img_file = os.path.join(self.data_dir, self.name, file_name)
192
 
193
  img = cv2.imread(img_file)
194
- assert img is not None
195
 
196
  return img
197
 
 
191
  img_file = os.path.join(self.data_dir, self.name, file_name)
192
 
193
  img = cv2.imread(img_file)
194
+ assert img is not None, f"file named {img_file} not found"
195
 
196
  return img
197
 
yolox/data/datasets/voc.py CHANGED
@@ -219,7 +219,7 @@ class VOCDetection(Dataset):
219
  def load_image(self, index):
220
  img_id = self.ids[index]
221
  img = cv2.imread(self._imgpath % img_id, cv2.IMREAD_COLOR)
222
- assert img is not None
223
 
224
  return img
225
 
 
219
  def load_image(self, index):
220
  img_id = self.ids[index]
221
  img = cv2.imread(self._imgpath % img_id, cv2.IMREAD_COLOR)
222
+ assert img is not None, f"file named {self._imgpath % img_id} not found"
223
 
224
  return img
225