Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions commonforms/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@

# Minimum valid image size
IMAGE_SIZE_MIN: int = 32
IMAGE_SIZE_MAX: int = 4096
2 changes: 1 addition & 1 deletion commonforms/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ class InvalidImageSizeError(InvalidInputError):

def __init__(self, image_size: int):
self.image_size = image_size
self.message = f"Image size must be a positive integer, got: {image_size}"
self.message = f"Image size must be between 32 and 4096, got: {image_size}"
super().__init__(self.message)
3 changes: 2 additions & 1 deletion commonforms/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
CONFIDENCE_MIN,
CONFIDENCE_MAX,
IMAGE_SIZE_MIN,
IMAGE_SIZE_MAX,
)

import formalpdf
Expand Down Expand Up @@ -257,7 +258,7 @@ def _validate_inputs(
raise InvalidConfidenceError(confidence)

# Validate image size
if image_size < IMAGE_SIZE_MIN:
if not (IMAGE_SIZE_MIN <= image_size <= IMAGE_SIZE_MAX):
raise InvalidImageSizeError(image_size)


Expand Down
2 changes: 1 addition & 1 deletion dataset/split_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def main():
json_dir = coco_dir / 'json'

if not images_dir.exists() or not json_dir.exists():
print(f"Error: Directory must contain 'images' and 'json' subdirectories")
print("Error: Directory must contain 'images' and 'json' subdirectories")
return 1

# Read CSV files
Expand Down