add *.jpeg support
This commit is contained in:
parent
c45cdc4fa3
commit
bc19e89247
|
@ -140,15 +140,14 @@ class LoadImagesAndLabels(Dataset): # for training/testing
|
||||||
assert n > 0, 'No images found in %s' % path
|
assert n > 0, 'No images found in %s' % path
|
||||||
self.img_size = img_size
|
self.img_size = img_size
|
||||||
self.augment = augment
|
self.augment = augment
|
||||||
|
self.image_weights = image_weights
|
||||||
|
self.rect = False if image_weights else rect
|
||||||
self.label_files = [x.replace('images', 'labels').
|
self.label_files = [x.replace('images', 'labels').
|
||||||
replace('.jpeg', '.txt').
|
replace('.jpeg', '.txt').
|
||||||
replace('.jpg', '.txt').
|
replace('.jpg', '.txt').
|
||||||
replace('.bmp', '.txt').
|
replace('.bmp', '.txt').
|
||||||
replace('.png', '.txt') for x in self.img_files]
|
replace('.png', '.txt') for x in self.img_files]
|
||||||
|
|
||||||
self.image_weights = image_weights
|
|
||||||
self.rect = False if image_weights else rect
|
|
||||||
|
|
||||||
# Rectangular Training https://github.com/ultralytics/yolov3/issues/232
|
# Rectangular Training https://github.com/ultralytics/yolov3/issues/232
|
||||||
if self.rect:
|
if self.rect:
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
@ -187,7 +186,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing
|
||||||
|
|
||||||
# Preload images
|
# Preload images
|
||||||
if n < 1001: # preload all images into memory if possible
|
if n < 1001: # preload all images into memory if possible
|
||||||
self.imgs = [cv2.imread(self.img_files[i]) for i in range(n)]
|
self.imgs = [cv2.imread(self.img_files[i]) for i in tqdm(range(n), desc='Reading images')]
|
||||||
|
|
||||||
# Preload labels (required for weighted CE training)
|
# Preload labels (required for weighted CE training)
|
||||||
self.labels = [np.zeros((0, 5))] * n
|
self.labels = [np.zeros((0, 5))] * n
|
||||||
|
|
|
@ -547,7 +547,7 @@ def plot_images(imgs, targets, fname='images.jpg'):
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
|
|
||||||
def plot_results(start=1, stop=0): # from utils.utils import *; plot_results()
|
def plot_results(start=0, stop=0): # from utils.utils import *; plot_results()
|
||||||
# Plot training results files 'results*.txt'
|
# Plot training results files 'results*.txt'
|
||||||
# import os; os.system('wget https://storage.googleapis.com/ultralytics/yolov3/results_v3.txt')
|
# import os; os.system('wget https://storage.googleapis.com/ultralytics/yolov3/results_v3.txt')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue