register.py 8.9 KB

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