File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed
Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 5151 "Failed" : 4
5252}
5353
54+ _MODEL_TRAINING_TASKS = {
55+ "Instance Segmentation for Pixel Projects" : "instance_segmentation_pixel" ,
56+ "Instance Segmentation for Vector Projects" : "instance_segmentation_vector" ,
57+ "Keypoint Detection for Vector Projects" : "keypoint_detection_vector" ,
58+ "Object Detection for Vector Projects" : "object_detection_vector" ,
59+ "Semantic Segmentation for Pixel Projects" : "semantic_segmentation_pixel"
60+ }
61+
5462
5563def prediction_segmentation_status_from_str_to_int (status ):
5664 return _PREDICTION_SEGMENTATION_STATUSES [status ]
Original file line number Diff line number Diff line change @@ -23,9 +23,11 @@ def search_projects(
2323 :rtype: list of strs or dicts
2424 """
2525 result_list = []
26+ limit = 1000
2627 params = {
2728 'team_id' : str (_api .team_id ),
2829 'offset' : 0 ,
30+ 'limit' : limit ,
2931 'completeImagesCount' : include_complete_image_count
3032 }
3133 if name is not None :
@@ -37,9 +39,9 @@ def search_projects(
3739 if response .ok :
3840 new_results = response .json ()
3941 result_list += new_results ["data" ]
40- if new_results ["count" ] <= len (result_list ):
42+ params ["offset" ] += limit
43+ if params ["offset" ] >= new_results ["count" ]:
4144 break
42- params ["offset" ] = len (result_list )
4345 else :
4446 raise SABaseException (
4547 response .status_code ,
Original file line number Diff line number Diff line change 1717from ..api import API
1818from ..common import (
1919 _AVAILABLE_SEGMENTATION_MODELS , model_training_status_int_to_str ,
20- project_type_str_to_int , upload_state_int_to_str
20+ project_type_str_to_int , upload_state_int_to_str , _MODEL_TRAINING_TASKS
2121)
2222from ..db .images import get_image_metadata , search_images
2323from ..exceptions import SABaseException
@@ -253,11 +253,11 @@ def run_training(
253253 hyperparameters [item ] = DEFAULT_HYPERPARAMETERS [item ]
254254 complete_image_count = 0
255255 for proj in project :
256- complete_image_count += proj ['completedImagesCount ' ]
256+ complete_image_count += proj ['rootFolderCompletedImagesCount ' ]
257257
258258 hyperparameters ["name" ] = model_name
259259 hyperparameters ["description" ] = model_description
260- hyperparameters ["task" ] = task
260+ hyperparameters ["task" ] = _MODEL_TRAINING_TASKS [ task ]
261261 hyperparameters ["base_model_id" ] = base_model ["id" ]
262262 hyperparameters ["project_ids" ] = project_ids
263263 hyperparameters ["image_count" ] = complete_image_count
You can’t perform that action at this time.
0 commit comments