Python Library Reference
The Python library provide two functions that run classification on an input image and write data to an output location.
API
kelp_o_matic.find_kelp(source, dest, species=False, crop_size=512, padding=256, batch_size=1, use_gpu=True)
Detect kelp in image at path source
and output the resulting classification raster
to file at path dest
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source |
str
|
Input image with Byte data type. |
required |
dest |
str
|
File path location to save output to. |
required |
species |
bool
|
Do species classification instead of presence/absence. |
False
|
crop_size |
int
|
The size of cropped image square run through the segmentation model. |
512
|
padding |
int
|
The number of context pixels added to each side of the cropped image. |
256
|
batch_size |
int
|
The batch size of cropped image sections to process together. |
1
|
use_gpu |
bool
|
Disable Cuda GPU usage and run on CPU only. |
True
|
Source code in kelp_o_matic/lib.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
Example
import kelp_o_matic
kelp_o_matic.find_kelp("./path/to/kelp_image.tif", "./path/to/output_file_to_write.tif", crop_size=3200)
kelp_o_matic.find_mussels(source, dest, crop_size=512, padding=256, batch_size=1, use_gpu=True)
Detect mussels in image at path source
and output the resulting classification
raster to file at path dest
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source |
str
|
Input image with Byte data type. |
required |
dest |
str
|
File path location to save output to. |
required |
crop_size |
int
|
The size of cropped image square run through the segmentation model. |
512
|
padding |
int
|
The number of context pixels added to each side of the cropped image. |
256
|
batch_size |
int
|
The batch size of cropped image sections to process together. |
1
|
use_gpu |
bool
|
Disable Cuda GPU usage and run on CPU only. |
True
|
Source code in kelp_o_matic/lib.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
Example
import kelp_o_matic
kelp_o_matic.find_mussels("./path/to/mussel_image.tif", "./path/to/output_file_to_write.tif", crop_size=3200)