| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -280,19 +280,22 @@ class LoadImagesAndLabels(Dataset):  # for training/testing
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    def __init__(self, path, img_size=640, batch_size=16, augment=False, hyp=None, rect=False, image_weights=False,
 | 
					 | 
					 | 
					 | 
					    def __init__(self, path, img_size=640, batch_size=16, augment=False, hyp=None, rect=False, image_weights=False,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                 cache_images=False, single_cls=False, stride=32, pad=0.0):
 | 
					 | 
					 | 
					 | 
					                 cache_images=False, single_cls=False, stride=32, pad=0.0):
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        try:
 | 
					 | 
					 | 
					 | 
					        try:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            path = str(Path(path))  # os-agnostic
 | 
					 | 
					 | 
					 | 
					            f = []
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            parent = str(Path(path).parent) + os.sep
 | 
					 | 
					 | 
					 | 
					            for p in path if isinstance(path, list) else [path]:
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if os.path.isfile(path):  # file
 | 
					 | 
					 | 
					 | 
					                p = str(Path(p))  # os-agnostic
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                with open(path, 'r') as f:
 | 
					 | 
					 | 
					 | 
					                parent = str(Path(p).parent) + os.sep
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    f = f.read().splitlines()
 | 
					 | 
					 | 
					 | 
					                if os.path.isfile(p):  # file
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    f = [x.replace('./', parent) if x.startswith('./') else x for x in f]  # local to global path
 | 
					 | 
					 | 
					 | 
					                    with open(p, 'r') as t:
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            elif os.path.isdir(path):  # folder
 | 
					 | 
					 | 
					 | 
					                        t = t.read().splitlines()
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                f = glob.iglob(path + os.sep + '*.*')
 | 
					 | 
					 | 
					 | 
					                        f += [x.replace('./', parent) if x.startswith('./') else x for x in t]  # local to global path
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                elif os.path.isdir(p):  # folder
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    f += glob.iglob(p + os.sep + '*.*')
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                else:
 | 
					 | 
					 | 
					 | 
					                else:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                raise Exception('%s does not exist' % path)
 | 
					 | 
					 | 
					 | 
					                    raise Exception('%s does not exist' % p)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            path = p  # *.npy dir
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            self.img_files = [x.replace('/', os.sep) for x in f if os.path.splitext(x)[-1].lower() in img_formats]
 | 
					 | 
					 | 
					 | 
					            self.img_files = [x.replace('/', os.sep) for x in f if os.path.splitext(x)[-1].lower() in img_formats]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        except:
 | 
					 | 
					 | 
					 | 
					        except Exception as e:
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            raise Exception('Error loading data from %s. See %s' % (path, help_url))
 | 
					 | 
					 | 
					 | 
					            raise Exception('Error loading data from %s: %s\nSee %s' % (path, e, help_url))
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        n = len(self.img_files)
 | 
					 | 
					 | 
					 | 
					        n = len(self.img_files)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        assert n > 0, 'No images found in %s. See %s' % (path, help_url)
 | 
					 | 
					 | 
					 | 
					        assert n > 0, 'No images found in %s. See %s' % (path, help_url)
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |