diff --git a/paddlex/cv/models/explanation/visualize.py b/paddlex/cv/models/explanation/visualize.py index bd097cf5285f007d8e81733773d6541743a318f6..c37b2e8aa9814098c9035b8328596651ae0a3b3e 100644 --- a/paddlex/cv/models/explanation/visualize.py +++ b/paddlex/cv/models/explanation/visualize.py @@ -28,6 +28,9 @@ def visualize(img_file, num_samples=3000, batch_size=50, save_dir='./'): + model_info = self.get_model_info() + if model_info['status'] != 'Normal': + raise Exception('The explanation only can deal with the Normal model') model.arrange_transforms( transforms=model.test_transforms, mode='test') tmp_transforms = copy.deepcopy(model.test_transforms) @@ -110,4 +113,4 @@ def precompute_for_normlime(predict_func, normlime_dataset, num_samples=3000, ba save_dir=save_dir) - \ No newline at end of file +