Semantic Segmentation
SemanticSegmentationModel
¶
Bases: InferenceModel
Run inference on a semantic segmentation model hosted on Roboflow or served through Roboflow Inference.
Source code in roboflow/models/semantic_segmentation.py
5 6 7 8 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 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
__init__(api_key, version_id)
¶
Create a SemanticSegmentationModel object through which you can run inference.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
str
|
private roboflow api key |
required |
version_id |
str
|
the workspace/project id |
required |
Source code in roboflow/models/semantic_segmentation.py
10 11 12 13 14 15 16 17 18 19 |
|
predict(image_path, confidence=50)
¶
Infers detections based on image from a specified model and image path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_path |
str
|
path to the image you'd like to perform prediction on |
required |
confidence |
int
|
confidence threshold for predictions, on a scale from 0-100 |
50
|
Returns:
Type | Description |
---|---|
PredictionGroup Object |
Example
import roboflow
rf = roboflow.Roboflow(api_key="")
project = rf.workspace().project("PROJECT_ID")
model = project.version("1").model
prediction = model.predict("YOUR_IMAGE.jpg")
Source code in roboflow/models/semantic_segmentation.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|