module ai.image_segmentation
¶
Short summary¶
module code_beatrix.ai.image_segmentation
Extracts objects from an image based on deep learning.
Classes¶
class |
truncated documentation |
---|---|
Segments an image. Inspired from infer.py. … |
Properties¶
property |
truncated documentation |
---|---|
Returns the model file name. |
Static Methods¶
staticmethod |
truncated documentation |
---|---|
Computes a new size. |
Methods¶
method |
truncated documentation |
---|---|
Loads an image as a numpy.array. |
|
Preprocesses the image before prediction. |
|
Displays the segmentation. |
|
Applies the model on features X. |
Documentation¶
Extracts objects from an image based on deep learning.
- class code_beatrix.ai.image_segmentation.DLImageSegmentation(model='FCN8s', n_class=21, gpu=False, class_name=None, fLOG=None)¶
Bases :
DeepLearningImage
Segments an image. Inspired from infer.py. See notebook Segmenter une image pixel à pixel.
- Paramètres:
model – model name
n_class – number of classes
gpu – use gpu
class_name – class names
fLOG – logging function
List of known models:
'FCN8s'
: image segmentation
- property ModelFile¶
Returns the model file name.
- __init__(model='FCN8s', n_class=21, gpu=False, class_name=None, fLOG=None)¶
- Paramètres:
model – model name
n_class – number of classes
gpu – use gpu
class_name – class names
fLOG – logging function
List of known models:
'FCN8s'
: image segmentation
- _load_image(img, resize=None)¶
Loads an image as a numpy.array.
- Paramètres:
img – image
resize – resize the image before predicting, see
_new_size
- Renvoie:
- static _new_size(old_size, new_size)¶
Computes a new size.
- Paramètres:
old_size – current size
new_size – new desired size
- Renvoie:
new size
new_size can be of:
(int, int): this is the new size
(“max2”, int): this size is divided by 2 until the greater dimension is below a threshold
- _preprocess(feat, preprocess=True)¶
Preprocesses the image before prediction.
- Paramètres:
feat – image (output of
_load_image
)preprocess – applies some preprocessing or not
- Renvoie:
preprocessed image
- plot(img, pred)¶
Displays the segmentation.
- Paramètres:
img – initial image
- Renvoie:
new image