Adam
commited on
Commit
·
34bf936
1
Parent(s):
faa6aea
Add more logging for diagnostics
Browse files- utils/datasets.py +7 -0
utils/datasets.py
CHANGED
|
@@ -261,6 +261,10 @@ class LoadImagesAndLabels(Dataset): # for training/testing
|
|
| 261 |
try:
|
| 262 |
path = str(Path(path)) # os-agnostic
|
| 263 |
parent = str(Path(path).parent) + os.sep
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
if os.path.isfile(path): # file
|
| 265 |
with open(path, 'r') as f:
|
| 266 |
f = f.read().splitlines()
|
|
@@ -274,7 +278,10 @@ class LoadImagesAndLabels(Dataset): # for training/testing
|
|
| 274 |
raise Exception('Error loading data from %s. See %s' % (path, help_url))
|
| 275 |
|
| 276 |
n = len(self.img_files)
|
|
|
|
| 277 |
assert n > 0, 'No images found in %s. See %s' % (path, help_url)
|
|
|
|
|
|
|
| 278 |
bi = np.floor(np.arange(n) / batch_size).astype(np.int) # batch index
|
| 279 |
nb = bi[-1] + 1 # number of batches
|
| 280 |
|
|
|
|
| 261 |
try:
|
| 262 |
path = str(Path(path)) # os-agnostic
|
| 263 |
parent = str(Path(path).parent) + os.sep
|
| 264 |
+
|
| 265 |
+
joined_path = os.path.join(os.getcwd(), parent)
|
| 266 |
+
print('Parent folder override for loading image files: %s' % (os.path.abspath(joined_path)))
|
| 267 |
+
|
| 268 |
if os.path.isfile(path): # file
|
| 269 |
with open(path, 'r') as f:
|
| 270 |
f = f.read().splitlines()
|
|
|
|
| 278 |
raise Exception('Error loading data from %s. See %s' % (path, help_url))
|
| 279 |
|
| 280 |
n = len(self.img_files)
|
| 281 |
+
print('Loaded %g images' % (n))
|
| 282 |
assert n > 0, 'No images found in %s. See %s' % (path, help_url)
|
| 283 |
+
|
| 284 |
+
|
| 285 |
bi = np.floor(np.arange(n) / batch_size).astype(np.int) # batch index
|
| 286 |
nb = bi[-1] + 1 # number of batches
|
| 287 |
|