瀏覽代碼

fix check_dataset bug for instance seg (#1852)

changdazhou 1 年之前
父節點
當前提交
7391a0d516

+ 2 - 3
paddlex/modules/instance_segmentation/dataset_checker/__init__.py

@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 import os
 
 from .dataset_src import check, convert, split_dataset, deep_analyse
@@ -49,8 +48,8 @@ class COCOInstSegDatasetChecker(BaseDatasetChecker):
             str: the root directory of splited dataset.
         """
         return split_dataset(src_dataset_dir,
-                             self.check_dataset_config.split_train_percent,
-                             self.check_dataset_config.split_val_percent)
+                             self.check_dataset_config.split.train_percent,
+                             self.check_dataset_config.split.val_percent)
 
     def check_dataset(self, dataset_dir: str,
                       sample_num: int=sample_num) -> dict:

+ 3 - 1
paddlex/modules/instance_segmentation/dataset_checker/dataset_src/check_dataset.py

@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 import json
 import os
 import os.path as osp
@@ -61,6 +60,9 @@ def check(dataset_dir, output, sample_num=10):
             vis_save_dir = osp.join(output, 'demo_img')
 
             image_info = jsondata['images']
+            sample_num = min(sample_num, len(image_info))
+            if sample_num < 10:
+                info('Only {} images in {}.json'.format(len(image_info), tag))
             for i in range(sample_num):
                 file_name = image_info[i]['file_name']
                 img_id = image_info[i]['id']