register.py 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. # copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
  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. import os
  15. import os.path as osp
  16. from pathlib import Path
  17. from ...base.register import register_model_info, register_suite_info
  18. from .model import InstanceSegModel
  19. from .config import InstanceSegConfig
  20. from .runner import InstanceSegRunner
  21. REPO_ROOT_PATH = os.environ.get("PADDLE_PDX_PADDLEDETECTION_PATH")
  22. PDX_CONFIG_DIR = osp.abspath(osp.join(osp.dirname(__file__), "..", "configs"))
  23. register_suite_info(
  24. {
  25. "suite_name": "InstanceSeg",
  26. "model": InstanceSegModel,
  27. "runner": InstanceSegRunner,
  28. "config": InstanceSegConfig,
  29. "runner_root_path": REPO_ROOT_PATH,
  30. }
  31. )
  32. ################ Models Using Universal Config ################
  33. register_model_info(
  34. {
  35. "model_name": "Mask-RT-DETR-S",
  36. "suite": "InstanceSeg",
  37. "config_path": osp.join(PDX_CONFIG_DIR, "Mask-RT-DETR-S.yaml"),
  38. "supported_apis": ["train", "evaluate", "predict", "export"],
  39. "supported_dataset_types": ["COCOInstSegDataset"],
  40. "supported_train_opts": {
  41. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  42. "dy2st": False,
  43. "amp": ["OFF"],
  44. },
  45. }
  46. )
  47. register_model_info(
  48. {
  49. "model_name": "Mask-RT-DETR-M",
  50. "suite": "InstanceSeg",
  51. "config_path": osp.join(PDX_CONFIG_DIR, "Mask-RT-DETR-M.yaml"),
  52. "supported_apis": ["train", "evaluate", "predict", "export"],
  53. "supported_dataset_types": ["COCOInstSegDataset"],
  54. "supported_train_opts": {
  55. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  56. "dy2st": False,
  57. "amp": ["OFF"],
  58. },
  59. }
  60. )
  61. register_model_info(
  62. {
  63. "model_name": "Mask-RT-DETR-L",
  64. "suite": "InstanceSeg",
  65. "config_path": osp.join(PDX_CONFIG_DIR, "Mask-RT-DETR-L.yaml"),
  66. "supported_apis": ["train", "evaluate", "predict", "export"],
  67. "supported_dataset_types": ["COCOInstSegDataset"],
  68. "supported_train_opts": {
  69. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  70. "dy2st": False,
  71. "amp": ["OFF"],
  72. },
  73. }
  74. )
  75. register_model_info(
  76. {
  77. "model_name": "Mask-RT-DETR-X",
  78. "suite": "InstanceSeg",
  79. "config_path": osp.join(PDX_CONFIG_DIR, "Mask-RT-DETR-X.yaml"),
  80. "supported_apis": ["train", "evaluate", "predict", "export"],
  81. "supported_dataset_types": ["COCOInstSegDataset"],
  82. "supported_train_opts": {
  83. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  84. "dy2st": False,
  85. "amp": ["OFF"],
  86. },
  87. }
  88. )
  89. register_model_info(
  90. {
  91. "model_name": "Mask-RT-DETR-H",
  92. "suite": "InstanceSeg",
  93. "config_path": osp.join(PDX_CONFIG_DIR, "Mask-RT-DETR-H.yaml"),
  94. "supported_apis": ["train", "evaluate", "predict", "export"],
  95. "supported_dataset_types": ["COCOInstSegDataset"],
  96. "supported_train_opts": {
  97. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  98. "dy2st": False,
  99. "amp": ["OFF"],
  100. },
  101. }
  102. )
  103. register_model_info(
  104. {
  105. "model_name": "SOLOv2",
  106. "suite": "InstanceSeg",
  107. "config_path": osp.join(PDX_CONFIG_DIR, "SOLOv2.yaml"),
  108. "supported_apis": ["train", "evaluate", "predict", "export"],
  109. "supported_dataset_types": ["COCOInstSegDataset"],
  110. "supported_train_opts": {
  111. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  112. "dy2st": False,
  113. "amp": ["OFF"],
  114. },
  115. }
  116. )
  117. register_model_info(
  118. {
  119. "model_name": "MaskRCNN-ResNet50",
  120. "suite": "InstanceSeg",
  121. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNet50.yaml"),
  122. "supported_apis": ["train", "evaluate", "predict", "export"],
  123. "supported_dataset_types": ["COCOInstSegDataset"],
  124. "supported_train_opts": {
  125. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  126. "dy2st": False,
  127. "amp": ["OFF"],
  128. },
  129. }
  130. )
  131. register_model_info(
  132. {
  133. "model_name": "MaskRCNN-ResNet50-FPN",
  134. "suite": "InstanceSeg",
  135. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNet50-FPN.yaml"),
  136. "supported_apis": ["train", "evaluate", "predict", "export"],
  137. "supported_dataset_types": ["COCOInstSegDataset"],
  138. "supported_train_opts": {
  139. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  140. "dy2st": False,
  141. "amp": ["OFF"],
  142. },
  143. }
  144. )
  145. register_model_info(
  146. {
  147. "model_name": "MaskRCNN-ResNet50-vd-FPN",
  148. "suite": "InstanceSeg",
  149. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNet50-vd-FPN.yaml"),
  150. "supported_apis": ["train", "evaluate", "predict", "export"],
  151. "supported_dataset_types": ["COCOInstSegDataset"],
  152. "supported_train_opts": {
  153. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  154. "dy2st": False,
  155. "amp": ["OFF"],
  156. },
  157. }
  158. )
  159. register_model_info(
  160. {
  161. "model_name": "MaskRCNN-ResNet101-FPN",
  162. "suite": "InstanceSeg",
  163. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNet101-FPN.yaml"),
  164. "supported_apis": ["train", "evaluate", "predict", "export"],
  165. "supported_dataset_types": ["COCOInstSegDataset"],
  166. "supported_train_opts": {
  167. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  168. "dy2st": False,
  169. "amp": ["OFF"],
  170. },
  171. }
  172. )
  173. register_model_info(
  174. {
  175. "model_name": "MaskRCNN-ResNet101-vd-FPN",
  176. "suite": "InstanceSeg",
  177. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNet101-vd-FPN.yaml"),
  178. "supported_apis": ["train", "evaluate", "predict", "export"],
  179. "supported_dataset_types": ["COCOInstSegDataset"],
  180. "supported_train_opts": {
  181. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  182. "dy2st": False,
  183. "amp": ["OFF"],
  184. },
  185. }
  186. )
  187. register_model_info(
  188. {
  189. "model_name": "MaskRCNN-ResNeXt101-vd-FPN",
  190. "suite": "InstanceSeg",
  191. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNeXt101-vd-FPN.yaml"),
  192. "supported_apis": ["train", "evaluate", "predict", "export"],
  193. "supported_dataset_types": ["COCOInstSegDataset"],
  194. "supported_train_opts": {
  195. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  196. "dy2st": False,
  197. "amp": ["OFF"],
  198. },
  199. }
  200. )
  201. register_model_info(
  202. {
  203. "model_name": "Cascade-MaskRCNN-ResNet50-FPN",
  204. "suite": "InstanceSeg",
  205. "config_path": osp.join(PDX_CONFIG_DIR, "Cascade-MaskRCNN-ResNet50-FPN.yaml"),
  206. "supported_apis": ["train", "evaluate", "predict", "export"],
  207. "supported_dataset_types": ["COCOInstSegDataset"],
  208. "supported_train_opts": {
  209. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  210. "dy2st": False,
  211. "amp": ["OFF"],
  212. },
  213. }
  214. )
  215. register_model_info(
  216. {
  217. "model_name": "Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN",
  218. "suite": "InstanceSeg",
  219. "config_path": osp.join(
  220. PDX_CONFIG_DIR, "Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN.yaml"
  221. ),
  222. "supported_apis": ["train", "evaluate", "predict", "export"],
  223. "supported_dataset_types": ["COCOInstSegDataset"],
  224. "supported_train_opts": {
  225. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  226. "dy2st": False,
  227. "amp": ["OFF"],
  228. },
  229. }
  230. )
  231. register_model_info(
  232. {
  233. "model_name": "PP-YOLOE_seg-S",
  234. "suite": "InstanceSeg",
  235. "config_path": osp.join(PDX_CONFIG_DIR, "PP-YOLOE_seg-S.yaml"),
  236. "supported_apis": ["train", "evaluate", "predict", "export"],
  237. "supported_dataset_types": ["COCOInstSegDataset"],
  238. "supported_train_opts": {
  239. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  240. "dy2st": False,
  241. "amp": ["OFF"],
  242. },
  243. }
  244. )