@@ -80,10 +80,7 @@ def plot_annotation(axes, prediction=None, stroke=1, transparency=60):
8080 elif prediction ["prediction_type" ] == INSTANCE_SEGMENTATION_MODEL :
8181 points = [[p ["x" ], p ["y" ]] for p in prediction ["points" ]]
8282 polygon = patches .Polygon (
83- points ,
84- linewidth = stroke ,
85- edgecolor = "r" ,
86- facecolor = "none" ,
83+ points , linewidth = stroke , edgecolor = "r" , facecolor = "none"
8784 )
8885 axes .add_patch (polygon )
8986 elif prediction ["prediction_type" ] == SEMANTIC_SEGMENTATION_MODEL :
@@ -476,14 +473,15 @@ def json(self):
476473 return prediction_group_json
477474
478475 @staticmethod
479- def create_prediction_group (json_response , image_path , prediction_type ):
476+ def create_prediction_group (json_response , image_path , prediction_type , image_dims ):
480477 """
481478 Method to create a prediction group based on the JSON Response
482479
483480 :param prediction_type:
484481 :param json_response: Based on Roboflow JSON Response from Inference API
485482 :param model:
486483 :param image_path:
484+ :param image_dims:
487485 :return:
488486 """
489487 prediction_list = []
@@ -494,15 +492,15 @@ def create_prediction_group(json_response, image_path, prediction_type):
494492 prediction , image_path , prediction_type = prediction_type
495493 )
496494 prediction_list .append (prediction )
497- img_dims = json_response [ "image" ]
495+ img_dims = image_dims
498496 elif prediction_type == CLASSIFICATION_MODEL :
499497 prediction = Prediction (json_response , image_path , prediction_type )
500498 prediction_list .append (prediction )
501- img_dims = {}
499+ img_dims = image_dims
502500 elif prediction_type == SEMANTIC_SEGMENTATION_MODEL :
503501 prediction = Prediction (json_response , image_path , prediction_type )
504502 prediction_list .append (prediction )
505- img_dims = json_response [ "image" ]
503+ img_dims = image_dims
506504
507505 # Seperate list and return as a prediction group
508506 return PredictionGroup (img_dims , image_path , * prediction_list )
0 commit comments