-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from HakaiInstitute/release/0.2.0
Release 0.2.0
- Loading branch information
Showing
12 changed files
with
112 additions
and
110 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,39 @@ | ||
from hakai_segmentation.managers import GeotiffSegmentation | ||
from hakai_segmentation.models import KelpPresenceSegmentationModel, MusselPresenceSegmentationModel | ||
from hakai_segmentation.models import KelpPresenceSegmentationModel, KelpSpeciesSegmentationModel, \ | ||
MusselPresenceSegmentationModel | ||
|
||
|
||
def find_kelp(source: str, dest: str, | ||
crop_size: int = 256, padding: int = 128, batch_size: int = 2, no_gpu: bool = False): | ||
def find_kelp(source: str, dest: str, species: bool = False, | ||
crop_size: int = 256, padding: int = 128, batch_size: int = 2, use_gpu: bool = True): | ||
"""Detect kelp in image at path `source` and output the resulting classification raster to file at path `dest`. | ||
:param source: Input image with Byte data type. | ||
:param dest: File path location to save output to. | ||
:param species: Do species classification instead of presence/absence. | ||
:param crop_size: The size of cropped image square run through the segmentation model. | ||
:param padding: The number of context pixels added to each side of the cropped image squares. | ||
:param batch_size: The batch size of cropped image sections to process together. | ||
:param no_gpu: Disable Cuda GPU usage and run on CPU only. | ||
:param use_gpu: Disable Cuda GPU usage and run on CPU only. | ||
""" | ||
model = KelpPresenceSegmentationModel(no_gpu=no_gpu) | ||
if species: | ||
model = KelpSpeciesSegmentationModel(use_gpu=use_gpu) | ||
else: | ||
model = KelpPresenceSegmentationModel(use_gpu=use_gpu) | ||
GeotiffSegmentation(model, source, dest, | ||
crop_size=crop_size, padding=padding, batch_size=batch_size)() | ||
|
||
|
||
def find_mussels(source: str, dest: str, | ||
crop_size: int = 256, padding: int = 128, batch_size: int = 2, no_gpu: bool = False): | ||
crop_size: int = 256, padding: int = 128, batch_size: int = 2, use_gpu: bool = True): | ||
"""Detect mussels in image at path `source` and output the resulting classification raster to file at path `dest`. | ||
:param source: Input image with Byte data type. | ||
:param dest: File path location to save output to. | ||
:param crop_size: The size of cropped image square run through the segmentation model. | ||
:param padding: The number of context pixels added to each side of the cropped image squares. | ||
:param batch_size: The batch size of cropped image sections to process together. | ||
:param no_gpu: Disable Cuda GPU usage and run on CPU only. | ||
:param use_gpu: Disable Cuda GPU usage and run on CPU only. | ||
""" | ||
|
||
model = MusselPresenceSegmentationModel(no_gpu=no_gpu) | ||
model = MusselPresenceSegmentationModel(use_gpu=use_gpu) | ||
GeotiffSegmentation(model, source, dest, | ||
crop_size=crop_size, padding=padding, batch_size=batch_size)() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters