Skip to content

Commit

Permalink
Transferred to a new structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mantasu committed Jan 4, 2024
1 parent 04caf24 commit 111e8b5
Show file tree
Hide file tree
Showing 16 changed files with 478 additions and 1,881 deletions.
7 changes: 5 additions & 2 deletions src/glasses_detector/_data/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,20 @@ def open_image_file(image_file, is_mask=False):
if isinstance(image_file, str):
# If the image is provided as a path
image_file = Image.open(image_file)
image_file = image_file.convert("L" if is_mask else "RGB")

if isinstance(image_file, Image.Image):
# If the image is not a numpy array
image_file = numpy.array(image_file)

if is_mask and image_file.ndim > 2:
# Convert the image black & white, ensure a single chan
# Convert image to black & white, ensure only 1 channel
image_file = (image_file > 127).any(axis=2).astype(numpy.uint8)
elif is_mask:
# Convert image to black & white of type UINT8
image_file = (image_file > 127).astype(numpy.uint8)
elif image_file.ndim == 2:
# Image is not a mask, so convert it to RGB
image_file = numpy.stack([image_file] * 3, axis=-1)

return image_file

Expand Down
3 changes: 0 additions & 3 deletions src/glasses_detector/bases/__init__.py

This file was deleted.

237 changes: 0 additions & 237 deletions src/glasses_detector/bases/base_classifier.py

This file was deleted.

Loading

0 comments on commit 111e8b5

Please sign in to comment.