Auto-format by https://ultralytics.com
parent
a483f06fea
commit
c9468ec281
|
@ -355,9 +355,9 @@ class LoadImages:
|
|||
self._new_video(videos[0]) # new video
|
||||
else:
|
||||
self.cap = None
|
||||
assert (
|
||||
self.nf > 0
|
||||
), f"No images or videos found in {p}. Supported formats are:\nimages: {IMG_FORMATS}\nvideos: {VID_FORMATS}"
|
||||
assert self.nf > 0, (
|
||||
f"No images or videos found in {p}. Supported formats are:\nimages: {IMG_FORMATS}\nvideos: {VID_FORMATS}"
|
||||
)
|
||||
|
||||
def __iter__(self):
|
||||
"""Initializes iterator by resetting count and returns the iterator object itself."""
|
||||
|
|
|
@ -495,9 +495,9 @@ def check_file(file, suffix=""):
|
|||
assert Path(file).exists() and Path(file).stat().st_size > 0, f"File download failed: {url}" # check
|
||||
return file
|
||||
elif file.startswith("clearml://"): # ClearML Dataset ID
|
||||
assert (
|
||||
"clearml" in sys.modules
|
||||
), "ClearML is not installed, so cannot use ClearML dataset. Try running 'pip install clearml'."
|
||||
assert "clearml" in sys.modules, (
|
||||
"ClearML is not installed, so cannot use ClearML dataset. Try running 'pip install clearml'."
|
||||
)
|
||||
return file
|
||||
else: # search
|
||||
files = []
|
||||
|
|
|
@ -41,11 +41,9 @@ def construct_dataset(clearml_info_string):
|
|||
with open(yaml_filenames[0]) as f:
|
||||
dataset_definition = yaml.safe_load(f)
|
||||
|
||||
assert set(
|
||||
dataset_definition.keys()
|
||||
).issuperset(
|
||||
{"train", "test", "val", "nc", "names"}
|
||||
), "The right keys were not found in the yaml file, make sure it at least has the following keys: ('train', 'test', 'val', 'nc', 'names')"
|
||||
assert set(dataset_definition.keys()).issuperset({"train", "test", "val", "nc", "names"}), (
|
||||
"The right keys were not found in the yaml file, make sure it at least has the following keys: ('train', 'test', 'val', 'nc', 'names')"
|
||||
)
|
||||
|
||||
data_dict = {
|
||||
"train": (
|
||||
|
|
|
@ -121,9 +121,9 @@ def select_device(device="", batch_size=0, newline=True):
|
|||
os.environ["CUDA_VISIBLE_DEVICES"] = "-1" # force torch.cuda.is_available() = False
|
||||
elif device: # non-cpu device requested
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = device # set environment variable - must be before assert is_available()
|
||||
assert torch.cuda.is_available() and torch.cuda.device_count() >= len(
|
||||
device.replace(",", "")
|
||||
), f"Invalid CUDA '--device {device}' requested, use '--device cpu' or pass valid CUDA device(s)"
|
||||
assert torch.cuda.is_available() and torch.cuda.device_count() >= len(device.replace(",", "")), (
|
||||
f"Invalid CUDA '--device {device}' requested, use '--device cpu' or pass valid CUDA device(s)"
|
||||
)
|
||||
|
||||
if not cpu and not mps and torch.cuda.is_available(): # prefer GPU if available
|
||||
devices = device.split(",") if device else "0" # range(torch.cuda.device_count()) # i.e. 0,1,6,7
|
||||
|
|
Loading…
Reference in New Issue