Forráskód Böngészése

change im type from uint8 to float32 in randomexpand

FlyingQianMM 5 éve
szülő
commit
d29714c868
1 módosított fájl, 3 hozzáadás és 3 törlés
  1. 3 3
      paddlex/cv/transforms/det_transforms.py

+ 3 - 3
paddlex/cv/transforms/det_transforms.py

@@ -757,9 +757,9 @@ class RandomExpand:
             return (im, im_info, label_info)
         y = np.random.randint(0, h - height)
         x = np.random.randint(0, w - width)
-        canvas = np.ones((h, w, 3), dtype=np.uint8)
-        canvas *= np.array(self.fill_value, dtype=np.uint8)
-        canvas[y:y + height, x:x + width, :] = im.astype(np.uint8)
+        canvas = np.ones((h, w, 3), dtype=np.float32)
+        canvas *= np.array(self.fill_value, dtype=np.float32)
+        canvas[y:y + height, x:x + width, :] = im
 
         im_info['augment_shape'] = np.array([h, w]).astype('int32')
         if 'gt_bbox' in label_info and len(label_info['gt_bbox']) > 0: