supervisely 6.73.436__py3-none-any.whl → 6.73.437__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- supervisely/nn/inference/predict_app/gui/gui.py +37 -20
- supervisely/nn/inference/predict_app/predict_app.py +10 -18
- {supervisely-6.73.436.dist-info → supervisely-6.73.437.dist-info}/METADATA +1 -1
- {supervisely-6.73.436.dist-info → supervisely-6.73.437.dist-info}/RECORD +8 -8
- {supervisely-6.73.436.dist-info → supervisely-6.73.437.dist-info}/LICENSE +0 -0
- {supervisely-6.73.436.dist-info → supervisely-6.73.437.dist-info}/WHEEL +0 -0
- {supervisely-6.73.436.dist-info → supervisely-6.73.437.dist-info}/entry_points.txt +0 -0
- {supervisely-6.73.436.dist-info → supervisely-6.73.437.dist-info}/top_level.txt +0 -0
|
@@ -548,13 +548,21 @@ class PredictAppGui:
|
|
|
548
548
|
|
|
549
549
|
# Input
|
|
550
550
|
# Input would be newely created project
|
|
551
|
+
input_args = {}
|
|
551
552
|
input_parameters = run_parameters["input"]
|
|
552
553
|
input_project_id = input_parameters.get("project_id", None)
|
|
553
554
|
if input_project_id is None:
|
|
554
555
|
raise ValueError("Input project ID is required for prediction.")
|
|
555
556
|
input_dataset_ids = input_parameters.get("dataset_ids", [])
|
|
556
|
-
|
|
557
|
+
input_image_ids = input_parameters.get("image_ids", [])
|
|
558
|
+
if not (input_dataset_ids or input_image_ids):
|
|
557
559
|
raise ValueError("At least one dataset must be selected for prediction.")
|
|
560
|
+
if input_image_ids:
|
|
561
|
+
input_args["image_ids"] = input_image_ids
|
|
562
|
+
elif input_dataset_ids:
|
|
563
|
+
input_args["dataset_ids"] = input_dataset_ids
|
|
564
|
+
else:
|
|
565
|
+
input_args["project_id"] = input_project_id
|
|
558
566
|
|
|
559
567
|
# Settings
|
|
560
568
|
settings = run_parameters["settings"]
|
|
@@ -582,23 +590,32 @@ class PredictAppGui:
|
|
|
582
590
|
# Always create new project
|
|
583
591
|
# But the actual inference will happen inplace
|
|
584
592
|
output_parameters = run_parameters["output"]
|
|
585
|
-
project_name = output_parameters
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
self.
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
593
|
+
project_name = output_parameters.get("project_name", "")
|
|
594
|
+
upload_to_source_project = output_parameters.get("upload_to_source_project", False)
|
|
595
|
+
if upload_to_source_project:
|
|
596
|
+
output_project_id = input_project_id
|
|
597
|
+
else:
|
|
598
|
+
if not project_name:
|
|
599
|
+
input_project_info = self.api.project.get_info_by_id(input_project_id)
|
|
600
|
+
project_name = input_project_info.name + " [Predictions]"
|
|
601
|
+
logger.warning("Project name is empty, using auto-generated name: " + project_name)
|
|
602
|
+
|
|
603
|
+
# Copy project
|
|
604
|
+
self.set_validator_text("Copying project...", "info")
|
|
605
|
+
created_project = copy_project(
|
|
606
|
+
self.api,
|
|
607
|
+
project_name,
|
|
608
|
+
self.workspace_id,
|
|
609
|
+
input_project_id,
|
|
610
|
+
input_dataset_ids,
|
|
611
|
+
with_annotations,
|
|
612
|
+
self.output_selector.progress,
|
|
613
|
+
)
|
|
614
|
+
output_project_id = created_project.id
|
|
615
|
+
input_args = {
|
|
616
|
+
"project_id": output_project_id,
|
|
617
|
+
}
|
|
618
|
+
|
|
602
619
|
# ------------------------ #
|
|
603
620
|
|
|
604
621
|
# Run prediction
|
|
@@ -607,7 +624,7 @@ class PredictAppGui:
|
|
|
607
624
|
self._is_running = True
|
|
608
625
|
try:
|
|
609
626
|
with model_api.predict_detached(
|
|
610
|
-
|
|
627
|
+
**input_args,
|
|
611
628
|
tqdm=self.output_selector.progress(),
|
|
612
629
|
**kwargs,
|
|
613
630
|
) as session:
|
|
@@ -635,7 +652,7 @@ class PredictAppGui:
|
|
|
635
652
|
|
|
636
653
|
# Set result thumbnail
|
|
637
654
|
self.set_validator_text("Project successfully processed", "success")
|
|
638
|
-
self.output_selector.set_result_thumbnail(
|
|
655
|
+
self.output_selector.set_result_thumbnail(output_project_id)
|
|
639
656
|
# ------------------------ #
|
|
640
657
|
return predictions
|
|
641
658
|
|
|
@@ -3,13 +3,13 @@ from typing import Dict, List, Optional
|
|
|
3
3
|
|
|
4
4
|
from fastapi import BackgroundTasks, Request
|
|
5
5
|
|
|
6
|
+
import supervisely.io.fs as sly_fs
|
|
6
7
|
from supervisely._utils import logger
|
|
7
8
|
from supervisely.api.api import Api
|
|
8
9
|
from supervisely.app.fastapi.subapp import Application
|
|
9
10
|
from supervisely.nn.inference.predict_app.gui.gui import PredictAppGui
|
|
10
|
-
from supervisely.nn.model.prediction import Prediction
|
|
11
11
|
from supervisely.nn.inference.predict_app.gui.utils import disable_enable
|
|
12
|
-
|
|
12
|
+
from supervisely.nn.model.prediction import Prediction
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class PredictApp:
|
|
@@ -91,14 +91,16 @@ class PredictApp:
|
|
|
91
91
|
# "mode": "custom",
|
|
92
92
|
# "train_task_id": 123
|
|
93
93
|
},
|
|
94
|
-
"
|
|
94
|
+
"input": {
|
|
95
95
|
"project_id": 123,
|
|
96
96
|
# "dataset_ids": [...],
|
|
97
97
|
# "video_id": 123
|
|
98
98
|
},
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
|
|
99
|
+
"settings": {
|
|
100
|
+
"inference_settings": {
|
|
101
|
+
"confidence_threshold": 0.5
|
|
102
|
+
},
|
|
103
|
+
}
|
|
102
104
|
"output": {
|
|
103
105
|
"mode": "create",
|
|
104
106
|
"project_name": "Predictions",
|
|
@@ -153,7 +155,7 @@ class PredictApp:
|
|
|
153
155
|
"inference_settings": {
|
|
154
156
|
"conf": 0.6,
|
|
155
157
|
},
|
|
156
|
-
"
|
|
158
|
+
"input": {
|
|
157
159
|
# "project_id": ...,
|
|
158
160
|
# "dataset_ids": [...],
|
|
159
161
|
"image_ids": [1148679, 1148675],
|
|
@@ -162,17 +164,7 @@ class PredictApp:
|
|
|
162
164
|
}
|
|
163
165
|
"""
|
|
164
166
|
state = request.state.state
|
|
165
|
-
|
|
166
|
-
"item": state["item"],
|
|
167
|
-
}
|
|
168
|
-
if "inference_settings" in state:
|
|
169
|
-
run_parameters["inference_settings"] = state["inference_settings"]
|
|
170
|
-
if "output" in state:
|
|
171
|
-
run_parameters["output"] = state["output"]
|
|
172
|
-
else:
|
|
173
|
-
run_parameters["output"] = {"mode": None}
|
|
174
|
-
|
|
175
|
-
predictions = self.run(run_parameters)
|
|
167
|
+
predictions = self.run(state)
|
|
176
168
|
return [prediction.to_json() for prediction in predictions]
|
|
177
169
|
|
|
178
170
|
@server.post("/run")
|
|
@@ -931,10 +931,10 @@ supervisely/nn/inference/object_detection_3d/object_detection_3d.py,sha256=GmBz7
|
|
|
931
931
|
supervisely/nn/inference/pose_estimation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
932
932
|
supervisely/nn/inference/pose_estimation/pose_estimation.py,sha256=oI-zWO7zY0-tHwGhSFmno3eSwE5I0BDKRDrZBoU9jPY,6452
|
|
933
933
|
supervisely/nn/inference/predict_app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
934
|
-
supervisely/nn/inference/predict_app/predict_app.py,sha256=
|
|
934
|
+
supervisely/nn/inference/predict_app/predict_app.py,sha256=iI_uxCzRpxY-XSXRUzwn261PQEIoQvCZFyRq0jtOv5w,6298
|
|
935
935
|
supervisely/nn/inference/predict_app/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
936
936
|
supervisely/nn/inference/predict_app/gui/classes_selector.py,sha256=V6fmsEnn8-FwoS7c9Bpms1jR_hqWDnGNIBU6s2a-XnQ,2916
|
|
937
|
-
supervisely/nn/inference/predict_app/gui/gui.py,sha256=
|
|
937
|
+
supervisely/nn/inference/predict_app/gui/gui.py,sha256=lLdRQA1iyZApbOPxL6lgFBiwcgm80OkMA-Etu2FoFSk,28831
|
|
938
938
|
supervisely/nn/inference/predict_app/gui/input_selector.py,sha256=Jh-eSU-cnqHtbcBfSjBCfZrq5nfQlPi7bOAzqqo26xc,6187
|
|
939
939
|
supervisely/nn/inference/predict_app/gui/model_selector.py,sha256=sGKzxaPwbTzP7_463sWeJe7qEfxntZHK6hYQPm6smFU,2453
|
|
940
940
|
supervisely/nn/inference/predict_app/gui/output_selector.py,sha256=lDX6q8Liw8wsbOae9DphOIEH1yKj5u2EwMqf0yO1mgY,4885
|
|
@@ -1127,9 +1127,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
1127
1127
|
supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
|
|
1128
1128
|
supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
|
|
1129
1129
|
supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
|
|
1130
|
-
supervisely-6.73.
|
|
1131
|
-
supervisely-6.73.
|
|
1132
|
-
supervisely-6.73.
|
|
1133
|
-
supervisely-6.73.
|
|
1134
|
-
supervisely-6.73.
|
|
1135
|
-
supervisely-6.73.
|
|
1130
|
+
supervisely-6.73.437.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
1131
|
+
supervisely-6.73.437.dist-info/METADATA,sha256=XBgqkLz3078y1s0fpxtmLbxX8MUVdFj_zR6fvjs-FsA,35433
|
|
1132
|
+
supervisely-6.73.437.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
1133
|
+
supervisely-6.73.437.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
|
|
1134
|
+
supervisely-6.73.437.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
|
|
1135
|
+
supervisely-6.73.437.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|