diff --git a/.doctrees/environment.pickle b/.doctrees/environment.pickle
index da4ddeb011..3e9baefe04 100644
Binary files a/.doctrees/environment.pickle and b/.doctrees/environment.pickle differ
diff --git a/latest/_modules/doctr/transforms/modules/base.html b/latest/_modules/doctr/transforms/modules/base.html
index 48cbf2a8fd..51dd961de0 100644
--- a/latest/_modules/doctr/transforms/modules/base.html
+++ b/latest/_modules/doctr/transforms/modules/base.html
@@ -425,11 +425,11 @@
Source code for doctr.transforms.modules.base
def __init__(self, transforms: List[Callable[[Any], Any]]) -> None:
self.transforms = transforms
- def __call__(self, img: Any) -> Any:
+ def __call__(self, img: Any, target: Optional[np.ndarray] = None) -> Union[Any, Tuple[Any, np.ndarray]]:
# Pick transformation
transfo = self.transforms[int(random.random() * len(self.transforms))]
# Apply
- return transfo(img)
+ return transfo(img) if target is None else transfo(img, target) # type: ignore[call-arg]
@@ -552,10 +552,12 @@ Source code for doctr.transforms.modules.base
if target.shape[1:] == (4, 2):
min_xy = np.min(target, axis=1)
max_xy = np.max(target, axis=1)
- target = np.concatenate((min_xy, max_xy), axis=1)
+ _target = np.concatenate((min_xy, max_xy), axis=1)
+ else:
+ _target = target
# Crop image and targets
- croped_img, crop_boxes = F.crop_detection(img, target, crop_box)
+ croped_img, crop_boxes = F.crop_detection(img, _target, crop_box)
# hard fallback if no box is kept
if crop_boxes.shape[0] == 0:
return img, target
diff --git a/v0.1.0/_modules/doctr/transforms/modules/base.html b/v0.1.0/_modules/doctr/transforms/modules/base.html
index 48cbf2a8fd..51dd961de0 100644
--- a/v0.1.0/_modules/doctr/transforms/modules/base.html
+++ b/v0.1.0/_modules/doctr/transforms/modules/base.html
@@ -425,11 +425,11 @@ Source code for doctr.transforms.modules.base
def __init__(self, transforms: List[Callable[[Any], Any]]) -> None:
self.transforms = transforms
- def __call__(self, img: Any) -> Any:
+ def __call__(self, img: Any, target: Optional[np.ndarray] = None) -> Union[Any, Tuple[Any, np.ndarray]]:
# Pick transformation
transfo = self.transforms[int(random.random() * len(self.transforms))]
# Apply
- return transfo(img)
+ return transfo(img) if target is None else transfo(img, target) # type: ignore[call-arg]
@@ -552,10 +552,12 @@ Source code for doctr.transforms.modules.base
if target.shape[1:] == (4, 2):
min_xy = np.min(target, axis=1)
max_xy = np.max(target, axis=1)
- target = np.concatenate((min_xy, max_xy), axis=1)
+ _target = np.concatenate((min_xy, max_xy), axis=1)
+ else:
+ _target = target
# Crop image and targets
- croped_img, crop_boxes = F.crop_detection(img, target, crop_box)
+ croped_img, crop_boxes = F.crop_detection(img, _target, crop_box)
# hard fallback if no box is kept
if crop_boxes.shape[0] == 0:
return img, target
diff --git a/v0.1.1/_modules/doctr/transforms/modules/base.html b/v0.1.1/_modules/doctr/transforms/modules/base.html
index 48cbf2a8fd..51dd961de0 100644
--- a/v0.1.1/_modules/doctr/transforms/modules/base.html
+++ b/v0.1.1/_modules/doctr/transforms/modules/base.html
@@ -425,11 +425,11 @@ Source code for doctr.transforms.modules.base
def __init__(self, transforms: List[Callable[[Any], Any]]) -> None:
self.transforms = transforms
- def __call__(self, img: Any) -> Any:
+ def __call__(self, img: Any, target: Optional[np.ndarray] = None) -> Union[Any, Tuple[Any, np.ndarray]]:
# Pick transformation
transfo = self.transforms[int(random.random() * len(self.transforms))]
# Apply
- return transfo(img)
+ return transfo(img) if target is None else transfo(img, target) # type: ignore[call-arg]
@@ -552,10 +552,12 @@ Source code for doctr.transforms.modules.base
if target.shape[1:] == (4, 2):
min_xy = np.min(target, axis=1)
max_xy = np.max(target, axis=1)
- target = np.concatenate((min_xy, max_xy), axis=1)
+ _target = np.concatenate((min_xy, max_xy), axis=1)
+ else:
+ _target = target
# Crop image and targets
- croped_img, crop_boxes = F.crop_detection(img, target, crop_box)
+ croped_img, crop_boxes = F.crop_detection(img, _target, crop_box)
# hard fallback if no box is kept
if crop_boxes.shape[0] == 0:
return img, target
diff --git a/v0.2.0/_modules/doctr/transforms/modules/base.html b/v0.2.0/_modules/doctr/transforms/modules/base.html
index 48cbf2a8fd..51dd961de0 100644
--- a/v0.2.0/_modules/doctr/transforms/modules/base.html
+++ b/v0.2.0/_modules/doctr/transforms/modules/base.html
@@ -425,11 +425,11 @@ Source code for doctr.transforms.modules.base
def __init__(self, transforms: List[Callable[[Any], Any]]) -> None:
self.transforms = transforms
- def __call__(self, img: Any) -> Any:
+ def __call__(self, img: Any, target: Optional[np.ndarray] = None) -> Union[Any, Tuple[Any, np.ndarray]]:
# Pick transformation
transfo = self.transforms[int(random.random() * len(self.transforms))]
# Apply
- return transfo(img)
+ return transfo(img) if target is None else transfo(img, target) # type: ignore[call-arg]
@@ -552,10 +552,12 @@ Source code for doctr.transforms.modules.base
if target.shape[1:] == (4, 2):
min_xy = np.min(target, axis=1)
max_xy = np.max(target, axis=1)
- target = np.concatenate((min_xy, max_xy), axis=1)
+ _target = np.concatenate((min_xy, max_xy), axis=1)
+ else:
+ _target = target
# Crop image and targets
- croped_img, crop_boxes = F.crop_detection(img, target, crop_box)
+ croped_img, crop_boxes = F.crop_detection(img, _target, crop_box)
# hard fallback if no box is kept
if crop_boxes.shape[0] == 0:
return img, target
diff --git a/v0.2.1/_modules/doctr/transforms/modules/base.html b/v0.2.1/_modules/doctr/transforms/modules/base.html
index 48cbf2a8fd..51dd961de0 100644
--- a/v0.2.1/_modules/doctr/transforms/modules/base.html
+++ b/v0.2.1/_modules/doctr/transforms/modules/base.html
@@ -425,11 +425,11 @@ Source code for doctr.transforms.modules.base
def __init__(self, transforms: List[Callable[[Any], Any]]) -> None:
self.transforms = transforms
- def __call__(self, img: Any) -> Any:
+ def __call__(self, img: Any, target: Optional[np.ndarray] = None) -> Union[Any, Tuple[Any, np.ndarray]]:
# Pick transformation
transfo = self.transforms[int(random.random() * len(self.transforms))]
# Apply
- return transfo(img)
+ return transfo(img) if target is None else transfo(img, target) # type: ignore[call-arg]
@@ -552,10 +552,12 @@ Source code for doctr.transforms.modules.base
if target.shape[1:] == (4, 2):
min_xy = np.min(target, axis=1)
max_xy = np.max(target, axis=1)
- target = np.concatenate((min_xy, max_xy), axis=1)
+ _target = np.concatenate((min_xy, max_xy), axis=1)
+ else:
+ _target = target
# Crop image and targets
- croped_img, crop_boxes = F.crop_detection(img, target, crop_box)
+ croped_img, crop_boxes = F.crop_detection(img, _target, crop_box)
# hard fallback if no box is kept
if crop_boxes.shape[0] == 0:
return img, target