From bc19e892476da3c36be6f6d7eb7f2f949e99d773 Mon Sep 17 00:00:00 2001
From: Glenn Jocher <glenn.jocher@ultralytics.com>
Date: Sat, 11 May 2019 14:38:48 +0200
Subject: [PATCH] add *.jpeg support

---
 utils/datasets.py | 7 +++----
 utils/utils.py    | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/utils/datasets.py b/utils/datasets.py
index b8d88a63..db2ac998 100755
--- a/utils/datasets.py
+++ b/utils/datasets.py
@@ -140,15 +140,14 @@ class LoadImagesAndLabels(Dataset):  # for training/testing
         assert n > 0, 'No images found in %s' % path
         self.img_size = img_size
         self.augment = augment
+        self.image_weights = image_weights
+        self.rect = False if image_weights else rect
         self.label_files = [x.replace('images', 'labels').
                                 replace('.jpeg', '.txt').
                                 replace('.jpg', '.txt').
                                 replace('.bmp', '.txt').
                                 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
         if self.rect:
             from PIL import Image
@@ -187,7 +186,7 @@ class LoadImagesAndLabels(Dataset):  # for training/testing
 
         # Preload images
         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)
         self.labels = [np.zeros((0, 5))] * n
diff --git a/utils/utils.py b/utils/utils.py
index 60b225d9..6eba4e5f 100755
--- a/utils/utils.py
+++ b/utils/utils.py
@@ -547,7 +547,7 @@ def plot_images(imgs, targets, fname='images.jpg'):
     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'
     # import os; os.system('wget https://storage.googleapis.com/ultralytics/yolov3/results_v3.txt')