__init__.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. from pathlib import Path
  15. from ...base import BaseDatasetChecker
  16. from ..model_list import MODELS
  17. from .dataset_src import check, deep_analyse
  18. class VideoDetDatasetChecker(BaseDatasetChecker):
  19. """Dataset Checker for Image Classification Model"""
  20. entities = MODELS
  21. sample_num = 10
  22. def convert_dataset(self, src_dataset_dir: str) -> str:
  23. """convert the dataset from other type to specified type
  24. Args:
  25. src_dataset_dir (str): the root directory of dataset.
  26. Returns:
  27. str: the root directory of converted dataset.
  28. """
  29. return src_dataset_dir
  30. def split_dataset(self, src_dataset_dir: str) -> str:
  31. """repartition the train and validation dataset
  32. Args:
  33. src_dataset_dir (str): the root directory of dataset.
  34. Returns:
  35. str: the root directory of splited dataset.
  36. """
  37. return src_dataset_dir
  38. def check_dataset(self, dataset_dir: str, sample_num: int = sample_num) -> dict:
  39. """check if the dataset meets the specifications and get dataset summary
  40. Args:
  41. dataset_dir (str): the root directory of dataset.
  42. sample_num (int): the number to be sampled.
  43. Returns:
  44. dict: dataset summary.
  45. """
  46. return check(dataset_dir, self.output)
  47. def analyse(self, dataset_dir: str) -> dict:
  48. """deep analyse dataset
  49. Args:
  50. dataset_dir (str): the root directory of dataset.
  51. Returns:
  52. dict: the deep analysis results.
  53. """
  54. return deep_analyse(dataset_dir, self.output)
  55. def get_show_type(self) -> str:
  56. """get the show type of dataset
  57. Returns:
  58. str: show type
  59. """
  60. return "video"
  61. def get_dataset_type(self) -> str:
  62. """return the dataset type
  63. Returns:
  64. str: dataset type
  65. """
  66. return "VideoDetDataset"