Skip to content

Commit

Permalink
update scaling to have the max be inside the image
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanklut committed Aug 30, 2024
1 parent 86f4ca2 commit 3c78583
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: laypa
channels:
# - default
- default
- pytorch
- nvidia
- conda-forge
Expand All @@ -20,10 +20,10 @@ dependencies:
- imagesize
- timm
- gunicorn
- openjpeg
- pillow
- shapely
- natsort
# - jpeg # For loading JPEG2000 images
# - pygments #Optional for colors
- pip:
- distinctipy
Expand Down
4 changes: 2 additions & 2 deletions environment_dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: laypa
channels:
# - default
- default
- pytorch
- nvidia
- conda-forge
Expand All @@ -21,10 +21,10 @@ dependencies:
- imagesize
- timm
- gunicorn
- openjpeg
- pillow
- shapely
- natsort
# - jpeg # For loading JPEG2000 images
# - pygments #Optional for colors
- pip:
- distinctipy
Expand Down
2 changes: 1 addition & 1 deletion page_xml/xml_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def from_config(cls, cfg: CfgNode) -> dict[str, Any]:

@staticmethod
def _scale_coords(coords: np.ndarray, out_size: tuple[int, int], size: tuple[int, int]) -> np.ndarray:
scale_factor = np.asarray(out_size) / np.asarray(size)
scale_factor = (np.asarray(out_size) - 1) / (np.asarray(size) - 1)
scaled_coords = (coords * scale_factor[::-1]).astype(np.float32)
return scaled_coords

Expand Down

0 comments on commit 3c78583

Please sign in to comment.