This view is limited to 50 files because it contains too many changes. See the raw diff here.
Files changed (50) hide show
  1. app.py +1 -1
  2. 4c_6c_regression.pt → best_yolo_model.pt +2 -2
  3. ultralytics/__pycache__/__init__.cpython-312.pyc +0 -0
  4. ultralytics/cfg/__pycache__/__init__.cpython-312.pyc +0 -0
  5. ultralytics/data/__pycache__/__init__.cpython-312.pyc +0 -0
  6. ultralytics/data/__pycache__/augment.cpython-312.pyc +1 -1
  7. ultralytics/data/__pycache__/base.cpython-312.pyc +0 -0
  8. ultralytics/data/__pycache__/build.cpython-312.pyc +0 -0
  9. ultralytics/data/__pycache__/converter.cpython-312.pyc +0 -0
  10. ultralytics/data/__pycache__/dataset.cpython-312.pyc +0 -0
  11. ultralytics/data/__pycache__/loaders.cpython-312.pyc +0 -0
  12. ultralytics/data/__pycache__/utils.cpython-312.pyc +0 -0
  13. ultralytics/data/augment.py +6 -1
  14. ultralytics/data/base.py +5 -0
  15. ultralytics/data/dataset.py +3 -0
  16. ultralytics/data/loaders.py +26 -3
  17. ultralytics/engine/__pycache__/__init__.cpython-312.pyc +0 -0
  18. ultralytics/engine/__pycache__/exporter.cpython-312.pyc +1 -1
  19. ultralytics/engine/__pycache__/model.cpython-312.pyc +0 -0
  20. ultralytics/engine/__pycache__/predictor.cpython-312.pyc +0 -0
  21. ultralytics/engine/__pycache__/results.cpython-312.pyc +0 -0
  22. ultralytics/engine/__pycache__/trainer.cpython-312.pyc +0 -0
  23. ultralytics/engine/__pycache__/validator.cpython-312.pyc +0 -0
  24. ultralytics/engine/model.py +1 -1
  25. ultralytics/engine/predictor.py +48 -4
  26. ultralytics/engine/validator.py +3 -2
  27. ultralytics/hub/__pycache__/__init__.cpython-312.pyc +0 -0
  28. ultralytics/hub/__pycache__/auth.cpython-312.pyc +0 -0
  29. ultralytics/hub/__pycache__/session.cpython-312.pyc +0 -0
  30. ultralytics/hub/__pycache__/utils.cpython-312.pyc +0 -0
  31. ultralytics/models/__pycache__/__init__.cpython-312.pyc +0 -0
  32. ultralytics/models/fastsam/__pycache__/__init__.cpython-312.pyc +0 -0
  33. ultralytics/models/fastsam/__pycache__/model.cpython-312.pyc +0 -0
  34. ultralytics/models/fastsam/__pycache__/predict.cpython-312.pyc +0 -0
  35. ultralytics/models/fastsam/__pycache__/utils.cpython-312.pyc +0 -0
  36. ultralytics/models/fastsam/__pycache__/val.cpython-312.pyc +0 -0
  37. ultralytics/models/nas/__pycache__/__init__.cpython-312.pyc +0 -0
  38. ultralytics/models/nas/__pycache__/model.cpython-312.pyc +0 -0
  39. ultralytics/models/nas/__pycache__/predict.cpython-312.pyc +0 -0
  40. ultralytics/models/nas/__pycache__/val.cpython-312.pyc +0 -0
  41. ultralytics/models/rtdetr/__pycache__/__init__.cpython-312.pyc +0 -0
  42. ultralytics/models/rtdetr/__pycache__/model.cpython-312.pyc +0 -0
  43. ultralytics/models/rtdetr/__pycache__/predict.cpython-312.pyc +0 -0
  44. ultralytics/models/rtdetr/__pycache__/train.cpython-312.pyc +0 -0
  45. ultralytics/models/rtdetr/__pycache__/val.cpython-312.pyc +0 -0
  46. ultralytics/models/sam/__pycache__/__init__.cpython-312.pyc +0 -0
  47. ultralytics/models/sam/__pycache__/amg.cpython-312.pyc +0 -0
  48. ultralytics/models/sam/__pycache__/build.cpython-312.pyc +0 -0
  49. ultralytics/models/sam/__pycache__/model.cpython-312.pyc +0 -0
  50. ultralytics/models/sam/__pycache__/predict.cpython-312.pyc +0 -0
app.py CHANGED
@@ -29,7 +29,7 @@ except Exception as e:
29
  ndvi_model = None
30
 
31
  try:
32
- yolo_model = load_yolo_model("4c_6c_regression.pt")
33
  logger.info("YOLO model loaded successfully")
34
  except Exception as e:
35
  logger.error(f"Failed to load YOLO model: {e}")
 
29
  ndvi_model = None
30
 
31
  try:
32
+ yolo_model = load_yolo_model("best_yolo_model.pt")
33
  logger.info("YOLO model loaded successfully")
34
  except Exception as e:
35
  logger.error(f"Failed to load YOLO model: {e}")
4c_6c_regression.pt → best_yolo_model.pt RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:158f2a49f42e9e3ef40c12de1d86ddff9465f834cb8c006bb38a3fd6a8f99b15
3
- size 5998089
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5be2b24cd635b1e8f6e6b56f0ec49ba7751f627439670597807cec7e6f6fdf3e
3
+ size 45153455
ultralytics/__pycache__/__init__.cpython-312.pyc CHANGED
Binary files a/ultralytics/__pycache__/__init__.cpython-312.pyc and b/ultralytics/__pycache__/__init__.cpython-312.pyc differ
 
ultralytics/cfg/__pycache__/__init__.cpython-312.pyc CHANGED
Binary files a/ultralytics/cfg/__pycache__/__init__.cpython-312.pyc and b/ultralytics/cfg/__pycache__/__init__.cpython-312.pyc differ
 
ultralytics/data/__pycache__/__init__.cpython-312.pyc CHANGED
Binary files a/ultralytics/data/__pycache__/__init__.cpython-312.pyc and b/ultralytics/data/__pycache__/__init__.cpython-312.pyc differ
 
ultralytics/data/__pycache__/augment.cpython-312.pyc CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e072113c34b0a95bcb988e80f9d25235235c73fdb7319f0221e197c4a50779d9
3
  size 139583
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f7f6b212a14a5068a553d00be673361718d528f2e6b2e324ea2a2e113a00191
3
  size 139583
ultralytics/data/__pycache__/base.cpython-312.pyc CHANGED
Binary files a/ultralytics/data/__pycache__/base.cpython-312.pyc and b/ultralytics/data/__pycache__/base.cpython-312.pyc differ
 
ultralytics/data/__pycache__/build.cpython-312.pyc CHANGED
Binary files a/ultralytics/data/__pycache__/build.cpython-312.pyc and b/ultralytics/data/__pycache__/build.cpython-312.pyc differ
 
ultralytics/data/__pycache__/converter.cpython-312.pyc CHANGED
Binary files a/ultralytics/data/__pycache__/converter.cpython-312.pyc and b/ultralytics/data/__pycache__/converter.cpython-312.pyc differ
 
ultralytics/data/__pycache__/dataset.cpython-312.pyc CHANGED
Binary files a/ultralytics/data/__pycache__/dataset.cpython-312.pyc and b/ultralytics/data/__pycache__/dataset.cpython-312.pyc differ
 
ultralytics/data/__pycache__/loaders.cpython-312.pyc CHANGED
Binary files a/ultralytics/data/__pycache__/loaders.cpython-312.pyc and b/ultralytics/data/__pycache__/loaders.cpython-312.pyc differ
 
ultralytics/data/__pycache__/utils.cpython-312.pyc CHANGED
Binary files a/ultralytics/data/__pycache__/utils.cpython-312.pyc and b/ultralytics/data/__pycache__/utils.cpython-312.pyc differ
 
ultralytics/data/augment.py CHANGED
@@ -1541,7 +1541,12 @@ class LetterBox:
1541
  self.stride = stride
1542
  self.center = center # Put the image in the middle or top-left
1543
 
1544
- def __call__(self, labels=None, image=None):
 
 
 
 
 
1545
  """
1546
  Resizes and pads an image for object detection, instance segmentation, or pose estimation tasks.
1547
 
 
1541
  self.stride = stride
1542
  self.center = center # Put the image in the middle or top-left
1543
 
1544
+ def __call__(self, labels=None, image=None): # gets image during inference (1544, 2064, 4) but not during validation
1545
+ # during validation, labels["img"].shape = (479, 640, 4)
1546
+ # function returns labels with labels["img"].shape = (512, 672, 4)
1547
+
1548
+ # during inference the image is already provided, image.shape = (1544, 2064, 4)
1549
+ # returns image with image.shape = (480, 640, 4)
1550
  """
1551
  Resizes and pads an image for object detection, instance segmentation, or pose estimation tasks.
1552
 
ultralytics/data/base.py CHANGED
@@ -160,8 +160,10 @@ class BaseDataset(Dataset):
160
  LOGGER.warning(f"{self.prefix}WARNING ⚠️ Removing corrupt *.npy image file {fn} due to: {e}")
161
  Path(fn).unlink(missing_ok=True)
162
  im = cv2.imread(f, cv2.IMREAD_UNCHANGED) # Load with all channels, including NDVI if present
 
163
  else: # read image
164
  im = cv2.imread(f, cv2.IMREAD_UNCHANGED) # Load with all channels, including NDVI if present
 
165
  if im is None:
166
  raise FileNotFoundError(f"Image Not Found {f}")
167
 
@@ -208,6 +210,7 @@ class BaseDataset(Dataset):
208
  f = self.npy_files[i]
209
  if not f.exists():
210
  np.save(f.as_posix(), cv2.imread(self.im_files[i], cv2.IMREAD_UNCHANGED), allow_pickle=False)
 
211
 
212
 
213
  def check_cache_disk(self, safety_margin=0.5):
@@ -219,6 +222,7 @@ class BaseDataset(Dataset):
219
  for _ in range(n):
220
  im_file = random.choice(self.im_files)
221
  im = cv2.imread(im_file, cv2.IMREAD_UNCHANGED) # Load with all channels, including NDVI if present
 
222
  if im is None:
223
  continue
224
  b += im.nbytes
@@ -244,6 +248,7 @@ class BaseDataset(Dataset):
244
  n = min(self.ni, 30) # extrapolate from 30 random images
245
  for _ in range(n):
246
  im = cv2.imread(random.choice(self.im_files), cv2.IMREAD_UNCHANGED) # sample image
 
247
  if im is None:
248
  continue
249
  ratio = self.imgsz / max(im.shape[0], im.shape[1]) # max(h, w) # ratio
 
160
  LOGGER.warning(f"{self.prefix}WARNING ⚠️ Removing corrupt *.npy image file {fn} due to: {e}")
161
  Path(fn).unlink(missing_ok=True)
162
  im = cv2.imread(f, cv2.IMREAD_UNCHANGED) # Load with all channels, including NDVI if present
163
+ # assert 0, '=========== Read unchanged image ============='
164
  else: # read image
165
  im = cv2.imread(f, cv2.IMREAD_UNCHANGED) # Load with all channels, including NDVI if present
166
+ # assert 0, '=========== Read unchanged image ============='
167
  if im is None:
168
  raise FileNotFoundError(f"Image Not Found {f}")
169
 
 
210
  f = self.npy_files[i]
211
  if not f.exists():
212
  np.save(f.as_posix(), cv2.imread(self.im_files[i], cv2.IMREAD_UNCHANGED), allow_pickle=False)
213
+ # assert 0, '=========== Read unchanged image ============='
214
 
215
 
216
  def check_cache_disk(self, safety_margin=0.5):
 
222
  for _ in range(n):
223
  im_file = random.choice(self.im_files)
224
  im = cv2.imread(im_file, cv2.IMREAD_UNCHANGED) # Load with all channels, including NDVI if present
225
+ # assert 0, '=========== Read unchanged image ============='
226
  if im is None:
227
  continue
228
  b += im.nbytes
 
248
  n = min(self.ni, 30) # extrapolate from 30 random images
249
  for _ in range(n):
250
  im = cv2.imread(random.choice(self.im_files), cv2.IMREAD_UNCHANGED) # sample image
251
+ # assert 0, '=========== Read unchanged image ============='
252
  if im is None:
253
  continue
254
  ratio = self.imgsz / max(im.shape[0], im.shape[1]) # max(h, w) # ratio
ultralytics/data/dataset.py CHANGED
@@ -560,12 +560,15 @@ class ClassificationDataset:
560
  if self.cache_ram:
561
  if im is None: # Warning: two separate if statements required here, do not combine this with previous line
562
  im = self.samples[i][3] = cv2.imread(f, cv2.IMREAD_UNCHANGED)
 
563
  elif self.cache_disk:
564
  if not fn.exists(): # load npy
565
  np.save(fn.as_posix(), cv2.imread(f, cv2.IMREAD_UNCHANGED), allow_pickle=False)
 
566
  im = np.load(fn)
567
  else: # read image
568
  im = cv2.imread(f, cv2.IMREAD_UNCHANGED) # BGR
 
569
  # Convert NumPy array to PIL image
570
  im = Image.fromarray(cv2.cvtColor(im, cv2.COLOR_BGR2RGB))
571
  sample = self.torch_transforms(im)
 
560
  if self.cache_ram:
561
  if im is None: # Warning: two separate if statements required here, do not combine this with previous line
562
  im = self.samples[i][3] = cv2.imread(f, cv2.IMREAD_UNCHANGED)
563
+ # assert 0, '=========== Read unchanged image ============='
564
  elif self.cache_disk:
565
  if not fn.exists(): # load npy
566
  np.save(fn.as_posix(), cv2.imread(f, cv2.IMREAD_UNCHANGED), allow_pickle=False)
567
+ # assert 0, '=========== Read unchanged image ============='
568
  im = np.load(fn)
569
  else: # read image
570
  im = cv2.imread(f, cv2.IMREAD_UNCHANGED) # BGR
571
+ # assert 0, '=========== Read unchanged image ============='
572
  # Convert NumPy array to PIL image
573
  im = Image.fromarray(cv2.cvtColor(im, cv2.COLOR_BGR2RGB))
574
  sample = self.torch_transforms(im)
ultralytics/data/loaders.py CHANGED
@@ -585,14 +585,37 @@ class LoadTensor:
585
  return self.bs
586
 
587
 
588
- def autocast_list(source):
589
  """Merges a list of sources into a list of numpy arrays or PIL images for Ultralytics prediction."""
590
  files = []
591
  # assert 0, f'in def autocast_list() source: {source}'
 
592
  for im in source:
593
  if isinstance(im, (str, Path)): # filename or uri
594
  # assert 0, f'im -> isinstance(im, (str, Path)) = True im= {im}'
595
- files.append(Image.open(requests.get(im, stream=True).raw if str(im).startswith("http") else im))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
  elif isinstance(im, (Image.Image, np.ndarray)): # PIL or np Image
597
  files.append(im)
598
  else:
@@ -605,7 +628,7 @@ def autocast_list(source):
605
  # import numpy as np
606
  # np_arr = np.array(files[0])
607
  # print(f'np_arr.shape: {np_arr.shape}')
608
- # assert 0, 'bye bye sucker'
609
  return files
610
 
611
 
 
585
  return self.bs
586
 
587
 
588
+ def autocast_list(source): # this function (as per experimentation) isn't called during validation or training, just inference
589
  """Merges a list of sources into a list of numpy arrays or PIL images for Ultralytics prediction."""
590
  files = []
591
  # assert 0, f'in def autocast_list() source: {source}'
592
+ # import itertools
593
  for im in source:
594
  if isinstance(im, (str, Path)): # filename or uri
595
  # assert 0, f'im -> isinstance(im, (str, Path)) = True im= {im}'
596
+ # assert 0, 'is the same func used in validation?'
597
+ # if str(im).startswith("http"):
598
+ # files.append(Image.open(requests.get(im, stream=True).raw if str(im).startswith("http") else im))
599
+
600
+ # pilimg = Image.open(requests.get(im, stream=True).raw if str(im).startswith("http") else im)
601
+ # orig_np_im = np.array(pilimg)
602
+
603
+ # for perm in itertools.permutations([0, 1, 2, 3]):
604
+ # np_im = orig_np_im[..., perm]
605
+ # # np_im = np.ascontiguousarray(np_im)
606
+ # files.append(Image.fromarray(np_im))
607
+
608
+ # np_im = orig_np_im[..., (0, 3, 2, 1)]
609
+ # np_im = np.ascontiguousarray(np_im)
610
+ # files.append(np_im)
611
+ if str(im).startswith("http"):
612
+ img = Image.open(requests.get(im, stream=True).raw)
613
+ else:
614
+ img = cv2.imread(im, cv2.IMREAD_UNCHANGED)
615
+ img = np.array(img)
616
+ img = img[..., (3,2,1,0)]
617
+ img = np.ascontiguousarray(img)
618
+ files.append(img)
619
  elif isinstance(im, (Image.Image, np.ndarray)): # PIL or np Image
620
  files.append(im)
621
  else:
 
628
  # import numpy as np
629
  # np_arr = np.array(files[0])
630
  # print(f'np_arr.shape: {np_arr.shape}')
631
+ # assert 0, 'bye bye'
632
  return files
633
 
634
 
ultralytics/engine/__pycache__/__init__.cpython-312.pyc CHANGED
Binary files a/ultralytics/engine/__pycache__/__init__.cpython-312.pyc and b/ultralytics/engine/__pycache__/__init__.cpython-312.pyc differ
 
ultralytics/engine/__pycache__/exporter.cpython-312.pyc CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d43eee4a96cf869121d1bc528ae7c8eed58d0f81baea7930b416f4a122dcf549
3
  size 101374
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b45eb6f61fa73af51b7cc3a8f73f05a4692f429d0d123cacdc8ee2af11704d11
3
  size 101374
ultralytics/engine/__pycache__/model.cpython-312.pyc CHANGED
Binary files a/ultralytics/engine/__pycache__/model.cpython-312.pyc and b/ultralytics/engine/__pycache__/model.cpython-312.pyc differ
 
ultralytics/engine/__pycache__/predictor.cpython-312.pyc CHANGED
Binary files a/ultralytics/engine/__pycache__/predictor.cpython-312.pyc and b/ultralytics/engine/__pycache__/predictor.cpython-312.pyc differ
 
ultralytics/engine/__pycache__/results.cpython-312.pyc CHANGED
Binary files a/ultralytics/engine/__pycache__/results.cpython-312.pyc and b/ultralytics/engine/__pycache__/results.cpython-312.pyc differ
 
ultralytics/engine/__pycache__/trainer.cpython-312.pyc CHANGED
Binary files a/ultralytics/engine/__pycache__/trainer.cpython-312.pyc and b/ultralytics/engine/__pycache__/trainer.cpython-312.pyc differ
 
ultralytics/engine/__pycache__/validator.cpython-312.pyc CHANGED
Binary files a/ultralytics/engine/__pycache__/validator.cpython-312.pyc and b/ultralytics/engine/__pycache__/validator.cpython-312.pyc differ
 
ultralytics/engine/model.py CHANGED
@@ -639,7 +639,7 @@ class Model(torch.nn.Module):
639
  args = {**self.overrides, **custom, **kwargs, "mode": "val"} # highest priority args on the right
640
 
641
  validator = (validator or self._smart_load("validator"))(args=args, _callbacks=self.callbacks)
642
- validator(model=self.model)
643
  self.metrics = validator.metrics
644
  return validator.metrics
645
 
 
639
  args = {**self.overrides, **custom, **kwargs, "mode": "val"} # highest priority args on the right
640
 
641
  validator = (validator or self._smart_load("validator"))(args=args, _callbacks=self.callbacks)
642
+ validator(model=self.model) # everything during validation happens here
643
  self.metrics = validator.metrics
644
  return validator.metrics
645
 
ultralytics/engine/predictor.py CHANGED
@@ -117,7 +117,7 @@ class BasePredictor:
117
  self._lock = threading.Lock() # for automatic thread-safe inference
118
  callbacks.add_integration_callbacks(self)
119
 
120
- def preprocess(self, im):
121
  # assert 0, 'def preprocess() called in predictory.py file'
122
  # the line above confirmed that this function is not called during
123
  # model.train() or model.val()
@@ -140,9 +140,37 @@ class BasePredictor:
140
 
141
  im = np.stack(self.pre_transform(im))
142
  print(f'im.shape : {im.shape} in def preprocess() predictor.py after self.pre_transform()')
143
- # im = im[..., ::-1].transpose((0, 3, 1, 2)) # BGR to RGB, BHWC to BCHW, (n, 3, h, w)
144
- im = im[..., [2, 1, 0, 3]].transpose((0, 3, 1, 2)) # adjusted to handle NDVI band. [B, G, R, NDVI] to [R, G, B, NDVI]
145
- # the transpose formats BHWC to BCHW
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  im = np.ascontiguousarray(im) # contiguous
147
  # print(f'im.shape: {im.shape} in def preprocess() predictor.py')
148
  im = torch.from_numpy(im)
@@ -276,6 +304,22 @@ class BasePredictor:
276
  # print(f'l276 pred.py im0s[0].shape: {im0s[0].shape}')
277
  im = self.preprocess(im0s)
278
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  # Inference
280
  with profilers[1]:
281
  preds = self.inference(im, *args, **kwargs)
 
117
  self._lock = threading.Lock() # for automatic thread-safe inference
118
  callbacks.add_integration_callbacks(self)
119
 
120
+ def preprocess(self, im): # this preprocess is called during inference
121
  # assert 0, 'def preprocess() called in predictory.py file'
122
  # the line above confirmed that this function is not called during
123
  # model.train() or model.val()
 
140
 
141
  im = np.stack(self.pre_transform(im))
142
  print(f'im.shape : {im.shape} in def preprocess() predictor.py after self.pre_transform()')
143
+ # im = im[..., ::-1].transpose((0, 3, 1, 2)) # BGR to RGB, BHWC to BCHW, (n, 3, h, w)
144
+ # im = im.transpose((0, 3, 1, 2)) # BGR to RGB, BHWC to BCHW, (n, 3, h, w)
145
+
146
+ im = im.transpose((0, 3, 1, 2)) # adjusted to handle NDVI band. [B, G, R, NDVI] to [R, G, B, NDVI]
147
+ # im = im[..., [0, 1, 2, 3]].transpose((0, 3, 1, 2)) # adjusted to handle NDVI band. [B, G, R, NDVI] to [R, G, B, NDVI]
148
+
149
+ # im = im[..., [0, 1, 2, 3]].transpose((0, 3, 1, 2)) # ❌
150
+ # im = im[..., [0, 1, 3, 2]].transpose((0, 3, 1, 2)) # ❌
151
+ # im = im[..., [0, 2, 1, 3]].transpose((0, 3, 1, 2)) # ❌
152
+ # im = im[..., [0, 2, 3, 1]].transpose((0, 3, 1, 2)) # ❌
153
+ # im = im[..., [0, 3, 1, 2]].transpose((0, 3, 1, 2)) # ❌
154
+ # im = im[..., [0, 3, 2, 1]].transpose((0, 3, 1, 2)) # ✅❌
155
+ # im = im[..., [1, 0, 2, 3]].transpose((0, 3, 1, 2)) # ❌
156
+ # im = im[..., [1, 0, 3, 2]].transpose((0, 3, 1, 2)) # ❌
157
+ # im = im[..., [1, 2, 0, 3]].transpose((0, 3, 1, 2)) # ❌
158
+ # im = im[..., [1, 2, 3, 0]].transpose((0, 3, 1, 2)) # ❌
159
+ # im = im[..., [1, 3, 0, 2]].transpose((0, 3, 1, 2)) # ❌
160
+ # im = im[..., [1, 3, 2, 0]].transpose((0, 3, 1, 2)) # ❌
161
+ # im = im[..., [2, 0, 1, 3]].transpose((0, 3, 1, 2)) # ❌
162
+ # im = im[..., [2, 0, 3, 1]].transpose((0, 3, 1, 2)) # ❌
163
+ # im = im[..., [2, 1, 0, 3]].transpose((0, 3, 1, 2)) # ❌
164
+ # im = im[..., [2, 1, 3, 0]].transpose((0, 3, 1, 2)) # ❌
165
+ # im = im[..., [2, 3, 0, 1]].transpose((0, 3, 1, 2)) # ❌
166
+ # im = im[..., [2, 3, 1, 0]].transpose((0, 3, 1, 2)) # ❌
167
+ # im = im[..., [3, 0, 1, 2]].transpose((0, 3, 1, 2)) # ❌
168
+ # im = im[..., [3, 0, 2, 1]].transpose((0, 3, 1, 2)) # ❌
169
+ # im = im[..., [3, 1, 0, 2]].transpose((0, 3, 1, 2)) # ❌
170
+ # im = im[..., [3, 1, 2, 0]].transpose((0, 3, 1, 2)) # ❌
171
+ # im = im[..., [3, 2, 0, 1]].transpose((0, 3, 1, 2)) # ❌
172
+ # im = im[..., [3, 2, 1, 0]].transpose((0, 3, 1, 2)) # ❌
173
+
174
  im = np.ascontiguousarray(im) # contiguous
175
  # print(f'im.shape: {im.shape} in def preprocess() predictor.py')
176
  im = torch.from_numpy(im)
 
304
  # print(f'l276 pred.py im0s[0].shape: {im0s[0].shape}')
305
  im = self.preprocess(im0s)
306
 
307
+ # preds[0].shape
308
+ # torch.Size([1, 43, 6300])
309
+
310
+ # preds[1][0][0].shape
311
+ # torch.Size([1, 71, 60, 80])
312
+ # preds[1][0][1].shape
313
+ # torch.Size([1, 71, 30, 40])
314
+ # preds[1][0][2].shape
315
+ # torch.Size([1, 71, 15, 20])
316
+
317
+ # preds[1][1][0].shape
318
+ # torch.Size([32, 6300])
319
+
320
+ # preds[1][2][0].shape
321
+ # torch.Size([32, 120, 160])
322
+
323
  # Inference
324
  with profilers[1]:
325
  preds = self.inference(im, *args, **kwargs)
ultralytics/engine/validator.py CHANGED
@@ -177,7 +177,7 @@ class BaseValidator:
177
  self.batch_i = batch_i
178
  # Preprocess
179
  with dt[0]:
180
- batch = self.preprocess(batch)
181
 
182
  # Inference
183
  with dt[1]:
@@ -190,7 +190,8 @@ class BaseValidator:
190
 
191
  # Postprocess
192
  with dt[3]:
193
- preds = self.postprocess(preds)
 
194
 
195
  self.update_metrics(preds, batch)
196
  if self.args.plots and batch_i < 3:
 
177
  self.batch_i = batch_i
178
  # Preprocess
179
  with dt[0]:
180
+ batch = self.preprocess(batch) # preprocessing the validation data, models hasn't done anything yet
181
 
182
  # Inference
183
  with dt[1]:
 
190
 
191
  # Postprocess
192
  with dt[3]:
193
+ preds = self.postprocess(preds) # in validation, preds does not contain the correct
194
+ # length of 39 per box, 4*coords, growth_val, 6*conf per each class, class (from 0-5, owing to 6 classes), 32*masks
195
 
196
  self.update_metrics(preds, batch)
197
  if self.args.plots and batch_i < 3:
ultralytics/hub/__pycache__/__init__.cpython-312.pyc CHANGED
Binary files a/ultralytics/hub/__pycache__/__init__.cpython-312.pyc and b/ultralytics/hub/__pycache__/__init__.cpython-312.pyc differ
 
ultralytics/hub/__pycache__/auth.cpython-312.pyc CHANGED
Binary files a/ultralytics/hub/__pycache__/auth.cpython-312.pyc and b/ultralytics/hub/__pycache__/auth.cpython-312.pyc differ
 
ultralytics/hub/__pycache__/session.cpython-312.pyc CHANGED
Binary files a/ultralytics/hub/__pycache__/session.cpython-312.pyc and b/ultralytics/hub/__pycache__/session.cpython-312.pyc differ
 
ultralytics/hub/__pycache__/utils.cpython-312.pyc CHANGED
Binary files a/ultralytics/hub/__pycache__/utils.cpython-312.pyc and b/ultralytics/hub/__pycache__/utils.cpython-312.pyc differ
 
ultralytics/models/__pycache__/__init__.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/__pycache__/__init__.cpython-312.pyc and b/ultralytics/models/__pycache__/__init__.cpython-312.pyc differ
 
ultralytics/models/fastsam/__pycache__/__init__.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/fastsam/__pycache__/__init__.cpython-312.pyc and b/ultralytics/models/fastsam/__pycache__/__init__.cpython-312.pyc differ
 
ultralytics/models/fastsam/__pycache__/model.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/fastsam/__pycache__/model.cpython-312.pyc and b/ultralytics/models/fastsam/__pycache__/model.cpython-312.pyc differ
 
ultralytics/models/fastsam/__pycache__/predict.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/fastsam/__pycache__/predict.cpython-312.pyc and b/ultralytics/models/fastsam/__pycache__/predict.cpython-312.pyc differ
 
ultralytics/models/fastsam/__pycache__/utils.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/fastsam/__pycache__/utils.cpython-312.pyc and b/ultralytics/models/fastsam/__pycache__/utils.cpython-312.pyc differ
 
ultralytics/models/fastsam/__pycache__/val.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/fastsam/__pycache__/val.cpython-312.pyc and b/ultralytics/models/fastsam/__pycache__/val.cpython-312.pyc differ
 
ultralytics/models/nas/__pycache__/__init__.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/nas/__pycache__/__init__.cpython-312.pyc and b/ultralytics/models/nas/__pycache__/__init__.cpython-312.pyc differ
 
ultralytics/models/nas/__pycache__/model.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/nas/__pycache__/model.cpython-312.pyc and b/ultralytics/models/nas/__pycache__/model.cpython-312.pyc differ
 
ultralytics/models/nas/__pycache__/predict.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/nas/__pycache__/predict.cpython-312.pyc and b/ultralytics/models/nas/__pycache__/predict.cpython-312.pyc differ
 
ultralytics/models/nas/__pycache__/val.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/nas/__pycache__/val.cpython-312.pyc and b/ultralytics/models/nas/__pycache__/val.cpython-312.pyc differ
 
ultralytics/models/rtdetr/__pycache__/__init__.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/rtdetr/__pycache__/__init__.cpython-312.pyc and b/ultralytics/models/rtdetr/__pycache__/__init__.cpython-312.pyc differ
 
ultralytics/models/rtdetr/__pycache__/model.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/rtdetr/__pycache__/model.cpython-312.pyc and b/ultralytics/models/rtdetr/__pycache__/model.cpython-312.pyc differ
 
ultralytics/models/rtdetr/__pycache__/predict.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/rtdetr/__pycache__/predict.cpython-312.pyc and b/ultralytics/models/rtdetr/__pycache__/predict.cpython-312.pyc differ
 
ultralytics/models/rtdetr/__pycache__/train.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/rtdetr/__pycache__/train.cpython-312.pyc and b/ultralytics/models/rtdetr/__pycache__/train.cpython-312.pyc differ
 
ultralytics/models/rtdetr/__pycache__/val.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/rtdetr/__pycache__/val.cpython-312.pyc and b/ultralytics/models/rtdetr/__pycache__/val.cpython-312.pyc differ
 
ultralytics/models/sam/__pycache__/__init__.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/sam/__pycache__/__init__.cpython-312.pyc and b/ultralytics/models/sam/__pycache__/__init__.cpython-312.pyc differ
 
ultralytics/models/sam/__pycache__/amg.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/sam/__pycache__/amg.cpython-312.pyc and b/ultralytics/models/sam/__pycache__/amg.cpython-312.pyc differ
 
ultralytics/models/sam/__pycache__/build.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/sam/__pycache__/build.cpython-312.pyc and b/ultralytics/models/sam/__pycache__/build.cpython-312.pyc differ
 
ultralytics/models/sam/__pycache__/model.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/sam/__pycache__/model.cpython-312.pyc and b/ultralytics/models/sam/__pycache__/model.cpython-312.pyc differ
 
ultralytics/models/sam/__pycache__/predict.cpython-312.pyc CHANGED
Binary files a/ultralytics/models/sam/__pycache__/predict.cpython-312.pyc and b/ultralytics/models/sam/__pycache__/predict.cpython-312.pyc differ