diff --git a/approach/ovod/APE/.gitignore b/approach/ovod/APE/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..a2838ec8611189532a2ff5c98b69ea485a021e62 --- /dev/null +++ b/approach/ovod/APE/.gitignore @@ -0,0 +1,53 @@ +# output dir +output +instant_test_output +inference_test_output + + +*.png +*.json +*.diff +*.jpg +!/projects/DensePose/doc/images/*.jpg + +# compilation and distribution +__pycache__ +_ext +*.pyc +*.pyd +*.so +*.dll +*.egg-info/ +build/ +dist/ +wheels/ + +# pytorch/python/numpy formats +*.pth +*.pkl +*.npy +*.ts +model_ts*.txt + +# ipython/jupyter notebooks +*.ipynb +**/.ipynb_checkpoints/ + +# Editor temporaries +*.swn +*.swo +*.swp +*~ + +# editor settings +.idea +.vscode +_darcs + +# project dirs +/ape/model_zoo/configs +/datasets/* +!/datasets/*.* +/projects/*/datasets +/models +/snippet diff --git a/approach/ovod/APE/LICENSE b/approach/ovod/APE/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/approach/ovod/APE/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/approach/ovod/APE/README.md b/approach/ovod/APE/README.md new file mode 100644 index 0000000000000000000000000000000000000000..250d549c90ceabadb1afa63504a719f42f320380 --- /dev/null +++ b/approach/ovod/APE/README.md @@ -0,0 +1,315 @@ +# APE: Aligning and Prompting Everything All at Once for Universal Visual Perception + + + + +
+
+
+
+
+
+
| + | name | +Checkpoint | +Config | +
|---|---|---|---|
| 1 | +APE-A | +HF link | +link | +
| 2 | +APE-B | +HF link + | link | +
| 3 | +APE-C | +HF link + | link | +
| 4 | +APE-D | +HF link + | link | +
+
+
+## :black_nib: Citation
+
+If you find our work helpful for your research, please consider citing the following BibTeX entry.
+
+```bibtex
+@inproceedings{APE,
+ title={Aligning and Prompting Everything All at Once for Universal Visual Perception},
+ author={Shen, Yunhang and Fu, Chaoyou and Chen, Peixian and Zhang, Mengdan and Li, Ke and Sun, Xing and Wu, Yunsheng and Lin, Shaohui and Ji, Rongrong},
+ journal={CVPR},
+ year={2024}
+}
+```
diff --git a/approach/ovod/APE/__init__.py b/approach/ovod/APE/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_r50_160k.py b/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_r50_160k.py
new file mode 100644
index 0000000000000000000000000000000000000000..1f2ed64d540f09fea245017dbc954ff926aeb4e4
--- /dev/null
+++ b/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_r50_160k.py
@@ -0,0 +1,46 @@
+from detectron2.config import LazyCall as L
+from detectron2.solver import WarmupParamScheduler
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ...COCO_InstanceSegmentation.ape_deta.ape_deta_r50_12ep import (
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+from ...common.data.ade20k_panoptic import dataloader
+
+num_classes = 150
+model.num_classes = num_classes
+model.criterion.num_classes = num_classes
+model.criterion.matcher_stage2.num_classes = num_classes
+
+model.model_vision.dataset_prompts = ["name"]
+model.model_vision.dataset_names = ["ade20k_panoptic"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = True
+
+model.model_vision.stuff_prob_thing = -1.0
+
+train.max_iter = 160000
+train.eval_period = 5000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1, 0.01],
+ milestones=[135000, 150000],
+ num_updates=160000,
+ ),
+ warmup_length=1000 / 160000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+model.model_vision.semantic_post_nms = False
+model.model_vision.panoptic_post_nms = True
+model.model_vision.aux_mask = True
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024.py b/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..90390fbc476a05a1675396ab88f4088de0767ac3
--- /dev/null
+++ b/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024.py
@@ -0,0 +1,101 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detrex.modeling.neck import ChannelMapper
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from .ape_deta_vitl_eva02_lsj1024 import dataloader, lr_multiplier, model, optimizer, train
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = -1.0
+model.model_vision.transformer.proposal_ambiguous = 1
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 12800
diff --git a/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_lsj1024.py b/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..d4b04c2419a8bf90c3b318d69d0d7598dc6f2eff
--- /dev/null
+++ b/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_lsj1024.py
@@ -0,0 +1,22 @@
+from ...COCO_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_12ep import (
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+from ...common.data.ade20k_panoptic_lsj1024 import dataloader
+
+model.model_vision.dataset_prompts = ["name"]
+model.model_vision.name_prompt_fusion_text = [False]
+model.model_vision.dataset_names = ["ade20k"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+model.model_vision.select_box_nums_for_evaluation = 300
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = True
+
+model.model_vision.stuff_prob_thing = -1.0
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024.py b/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..1a3ad5980ce9d1f48e3bc8d130bf389eeba0ec44
--- /dev/null
+++ b/approach/ovod/APE/configs/ADE20k_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024.py
@@ -0,0 +1,47 @@
+from detectron2.config import LazyCall as L
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+
+from .ape_deta_vitl_eva02_lsj1024 import dataloader, lr_multiplier, model, optimizer, train
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 12800
diff --git a/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_12ep.py b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..79354148c17b8d14984ed0d41725a1923564c173
--- /dev/null
+++ b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_12ep.py
@@ -0,0 +1,29 @@
+from detectron2.config import LazyCall as L
+from detrex.config import get_config
+
+from ...COCO_InstanceSegmentation.ape_deta.ape_deta_r50_12ep import (
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+from ...common.data.coco_refcoco_instance import dataloader
+
+model.model_vision.num_classes = 80
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+model.model_vision.criterion = [criterion for _ in range(2)]
+for criterion, num_classes in zip(model.model_vision.criterion, [80, 1]):
+ criterion.num_classes = num_classes
+
+model.model_vision.criterion[1].weight_dict["loss_class_enc"] = 0.0
+
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = [16, 16]
+
+model.model_vision.dataset_prompts = ["name", "expression"]
+model.model_vision.dataset_names = ["coco_2017", "refcoco"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_24ep.py b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_24ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..fc8b561a73849c1c9dd269c7d97ef19f4f03af79
--- /dev/null
+++ b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_24ep.py
@@ -0,0 +1,12 @@
+from detrex.config import get_config
+
+from .ape_deta_r50_12ep import dataloader, model, optimizer, train
+
+lr_multiplier = get_config("common/coco_schedule.py").lr_multiplier_24ep
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.output_dir = train.output_dir
+
+train.max_iter = 180000
+
+train.eval_period = 10000
diff --git a/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_36ep.py b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_36ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..1ff0df9068767007eebd5d7638b01e8c8645bae4
--- /dev/null
+++ b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_36ep.py
@@ -0,0 +1,12 @@
+from detrex.config import get_config
+
+from .ape_deta_r50_12ep import dataloader, model, optimizer, train
+
+lr_multiplier = get_config("common/coco_schedule.py").lr_multiplier_36ep
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.output_dir = train.output_dir
+
+train.max_iter = 270000
+
+train.eval_period = 15000
diff --git a/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_vlf_12ep.py b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_vlf_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..964fb02c5b1d1e63728d5a7c8416073dc1598533
--- /dev/null
+++ b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_vlf_12ep.py
@@ -0,0 +1,52 @@
+from detectron2.config import LazyCall as L
+from omegaconf import OmegaConf
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+
+from .ape_deta_r50_12ep import dataloader, lr_multiplier, model, optimizer, train
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ cfg=OmegaConf.from_dotlist(
+ [
+ "MODEL.DYHEAD.FUSE_CONFIG.STABLE_SOFTMAX_2D=False",
+ "MODEL.DYHEAD.FUSE_CONFIG.CLAMP_MIN_FOR_UNDERFLOW=True",
+ "MODEL.DYHEAD.FUSE_CONFIG.CLAMP_MAX_FOR_OVERFLOW=True",
+ "MODEL.VL_FUSION_USE_CHECKPOINT=True",
+ ],
+ ),
+)
+
+
+model.model_vision.text_feature_bank = False
+model.model_vision.text_feature_reduce_before_fusion = False
+model.model_vision.text_feature_batch_repeat = False
+model.model_vision.expression_cumulative_gt_class = False
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_vlf_36ep.py b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_vlf_36ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..af3ecaba7d66027bdd0a1c1376bbccd34b76d348
--- /dev/null
+++ b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_vlf_36ep.py
@@ -0,0 +1,12 @@
+from detrex.config import get_config
+
+from .ape_deta_r50_vlf_12ep import dataloader, model, optimizer, train
+
+lr_multiplier = get_config("common/coco_schedule.py").lr_multiplier_36ep
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.output_dir = train.output_dir
+
+train.max_iter = 270000
+
+train.eval_period = 15000
diff --git a/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_vlf_bert_36ep.py b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_vlf_bert_36ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..13be9e18bc60755d5e1265faedacb3855d9a1e91
--- /dev/null
+++ b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_r50_vlf_bert_36ep.py
@@ -0,0 +1,21 @@
+from detectron2.config import LazyCall as L
+from ape.modeling.text import Bert
+
+from .ape_deta_r50_vlf_36ep import dataloader, lr_multiplier, model, optimizer, train
+
+model.model_vision.criterion[1].num_classes = 1
+
+model.model_language = L(Bert)(
+ pretrained_model_name_or_path="models/huggingface/bert-base-uncased/"
+)
+model.model_vision.embed_dim_language = 768
+model.model_vision.text_feature_reduce_type = "average"
+
+model.model_vision.text_feature_bank = False
+model.model_vision.text_feature_reduce_before_fusion = False
+model.model_vision.text_feature_batch_repeat = False
+model.model_vision.expression_cumulative_gt_class = False
+
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_vitl_eva02_lsj1024_12ep.py b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_vitl_eva02_lsj1024_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..98758b3f9c34bb0e67039732776b20d69645e77a
--- /dev/null
+++ b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_vitl_eva02_lsj1024_12ep.py
@@ -0,0 +1,118 @@
+from functools import partial
+
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.modeling.backbone.fpn import LastLevelMaxPool
+from detrex.config import get_config
+from ape.modeling.backbone.vit import get_vit_lr_decay_rate
+from ape.modeling.backbone.vit_eva02 import SimpleFeaturePyramid, ViT
+from ape.modeling.text import EVA01CLIP
+
+from .....detectron2.configs.common.data.constants import constants
+from ...common.data.coco_refcoco_instance_lsj1024 import dataloader
+from .models.ape_deta_r50 import model
+
+model.model_vision.pixel_mean = constants.imagenet_rgb256_mean
+model.model_vision.pixel_std = constants.imagenet_rgb256_std
+model.model_vision.input_format = "RGB"
+
+model.model_vision.backbone = L(SimpleFeaturePyramid)(
+ net=L(ViT)( # Single-scale ViT backbone
+ img_size=1024,
+ patch_size=16,
+ embed_dim=1024,
+ depth=24,
+ num_heads=16,
+ drop_path_rate=0.4,
+ window_size=16,
+ mlp_ratio=4 * 2 / 3,
+ qkv_bias=True,
+ norm_layer=partial(nn.LayerNorm, eps=1e-6),
+ window_block_indexes=list(range(0, 5))
+ + list(range(6, 11))
+ + list(range(12, 17))
+ + list(range(18, 23)),
+ residual_block_indexes=[],
+ use_rel_pos=True,
+ out_feature="last_feat",
+ use_act_checkpoint=True,
+ xattn=True,
+ ),
+ in_feature="${.net.out_feature}",
+ out_channels=256,
+ scale_factors=(4.0, 2.0, 1.0, 0.5),
+ top_block=L(LastLevelMaxPool)(),
+ norm="LN",
+ square_pad=1024,
+)
+
+model.model_vision.neck = None
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+optimizer = get_config("common/optim.py").AdamW
+optimizer.params.lr_factor_func = (
+ lambda module_name: 0.1
+ if "reference_points" in module_name or "sampling_offsets" in module_name
+ else get_vit_lr_decay_rate(module_name, lr_decay_rate=0.8, num_layers=24)
+ if "backbone.net" in module_name
+ else 1
+)
+optimizer.params.overrides = {"pos_embed": {"weight_decay": 0.0}}
+optimizer.params.weight_decay_norm = None
+
+optimizer.lr = 2e-4
+optimizer.betas = (0.9, 0.999)
+optimizer.weight_decay = 1e-4
+
+train = get_config("common/train.py").train
+train.max_iter = 90000
+train.eval_period = 5000
+train.log_period = 20
+
+train.checkpointer.period = 5000
+train.checkpointer.max_to_keep = 2
+
+train.clip_grad.enabled = True
+train.clip_grad.params.max_norm = 0.1
+train.clip_grad.params.norm_type = 2
+
+train.device = "cuda"
+
+train.init_checkpoint = (
+ "models/Yunxin-CV/EVA-02/eva02/pt/eva02_L_pt_in21k_p14to16.pt?matching_heuristics=True"
+)
+
+train.amp.enabled = True
+train.ddp.fp16_compression = True
+
+lr_multiplier = get_config("common/coco_schedule.py").lr_multiplier_12ep
+lr_multiplier.scheduler.milestones = [75000, 90000]
+lr_multiplier.warmup_length = 1000 / train.max_iter
+
+dataloader.train.num_workers = 16
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = [16, 16]
+dataloader.train.mapper.image_format = "RGB"
+dataloader.train.mapper.use_instance_mask = True
+
+model.model_vision.dataset_prompts = ["name", "expression"]
+model.model_vision.dataset_names = ["coco_2017", "refcoco"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.output_dir = train.output_dir
+
+model.model_language = L(EVA01CLIP)(
+ clip_model="EVA_CLIP_g_14_X", cache_dir="models/BAAI/EVA/eva_clip_psz14.pt"
+)
+model.model_vision.embed_dim_language = 1024
diff --git a/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_36ep.py b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_36ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..462c7d32a2174a9eb676fc99ee5165cbcc9ea2d3
--- /dev/null
+++ b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_36ep.py
@@ -0,0 +1,118 @@
+from functools import partial
+
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.modeling.backbone.fpn import LastLevelMaxPool
+from detrex.config import get_config
+from ape.modeling.backbone.vit import get_vit_lr_decay_rate
+from ape.modeling.backbone.vit_eva02 import SimpleFeaturePyramid, ViT
+from ape.modeling.text import EVA01CLIP
+
+from .....detectron2.configs.common.data.constants import constants
+from ...common.data.coco_refcoco_instance_lsj1024 import dataloader
+from .models.ape_deta_r50_vlf import model
+
+model.model_vision.pixel_mean = constants.imagenet_rgb256_mean
+model.model_vision.pixel_std = constants.imagenet_rgb256_std
+model.model_vision.input_format = "RGB"
+
+model.model_vision.backbone = L(SimpleFeaturePyramid)(
+ net=L(ViT)( # Single-scale ViT backbone
+ img_size=1024,
+ patch_size=16,
+ embed_dim=1024,
+ depth=24,
+ num_heads=16,
+ drop_path_rate=0.4,
+ window_size=16,
+ mlp_ratio=4 * 2 / 3,
+ qkv_bias=True,
+ norm_layer=partial(nn.LayerNorm, eps=1e-6),
+ window_block_indexes=list(range(0, 5))
+ + list(range(6, 11))
+ + list(range(12, 17))
+ + list(range(18, 23)),
+ residual_block_indexes=[],
+ use_rel_pos=True,
+ out_feature="last_feat",
+ use_act_checkpoint=False,
+ xattn=True,
+ ),
+ in_feature="${.net.out_feature}",
+ out_channels=256,
+ scale_factors=(4.0, 2.0, 1.0, 0.5),
+ top_block=L(LastLevelMaxPool)(),
+ norm="LN",
+ square_pad=1024,
+)
+
+model.model_vision.neck = None
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+optimizer = get_config("common/optim.py").AdamW
+optimizer.params.lr_factor_func = (
+ lambda module_name: 0.1
+ if "reference_points" in module_name or "sampling_offsets" in module_name
+ else get_vit_lr_decay_rate(module_name, lr_decay_rate=0.8, num_layers=24)
+ if "backbone.net" in module_name
+ else 1
+)
+optimizer.params.overrides = {"pos_embed": {"weight_decay": 0.0}}
+optimizer.params.weight_decay_norm = None
+
+optimizer.lr = 2e-4
+optimizer.betas = (0.9, 0.999)
+optimizer.weight_decay = 1e-4
+
+train = get_config("common/train.py").train
+train.max_iter = 270000
+train.eval_period = 27000
+train.log_period = 20
+
+train.checkpointer.period = 5000
+train.checkpointer.max_to_keep = 2
+
+train.clip_grad.enabled = True
+train.clip_grad.params.max_norm = 0.1
+train.clip_grad.params.norm_type = 2
+
+train.device = "cuda"
+
+train.init_checkpoint = (
+ "models/Yunxin-CV/EVA-02/eva02/pt/eva02_L_pt_in21k_p14to16.pt?matching_heuristics=True"
+)
+
+train.amp.enabled = True
+train.ddp.fp16_compression = True
+
+lr_multiplier = get_config("common/coco_schedule.py").lr_multiplier_36ep
+lr_multiplier.warmup_length = 1000 / train.max_iter
+
+dataloader.train.num_workers = 16
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = [16, 16]
+dataloader.train.mapper.image_format = "RGB"
+dataloader.train.mapper.use_instance_mask = True
+
+model.model_vision.dataset_prompts = ["name", "expression"]
+model.model_vision.dataset_names = ["coco_2017", "refcoco"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.output_dir = train.output_dir
+
+model.model_language = L(EVA01CLIP)(
+ clip_model="EVA_CLIP_g_14_X", cache_dir="models/BAAI/EVA/eva_clip_psz14.pt"
+)
+model.model_vision.embed_dim_language = 1024
+
diff --git a/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_vitl_lsj1024_12ep.py b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_vitl_lsj1024_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..61103dfb69326d22431ce3dcee807f7a107df01d
--- /dev/null
+++ b/approach/ovod/APE/configs/COCO_REFCOCO/ape_deta/ape_deta_vitl_lsj1024_12ep.py
@@ -0,0 +1,114 @@
+from functools import partial
+
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.modeling.backbone.fpn import LastLevelMaxPool
+from detectron2.modeling.backbone.vit import SimpleFeaturePyramid, ViT, get_vit_lr_decay_rate
+from detrex.config import get_config
+from ape.modeling.text import EVA01CLIP
+
+from .....detectron2.configs.common.data.constants import constants
+from ...common.data.coco_refcoco_instance_lsj1024 import dataloader
+from .models.ape_deta_r50 import model
+
+model.model_vision.pixel_mean = constants.imagenet_rgb256_mean
+model.model_vision.pixel_std = constants.imagenet_rgb256_std
+model.model_vision.input_format = "RGB"
+
+model.model_vision.backbone = L(SimpleFeaturePyramid)(
+ net=L(ViT)( # Single-scale ViT backbone
+ img_size=1024,
+ patch_size=16,
+ embed_dim=1024,
+ depth=24,
+ num_heads=16,
+ drop_path_rate=0.4,
+ window_size=14,
+ mlp_ratio=4,
+ norm_layer=partial(nn.LayerNorm, eps=1e-6),
+ window_block_indexes=list(range(0, 5))
+ + list(range(6, 11))
+ + list(range(12, 17))
+ + list(range(18, 23)),
+ residual_block_indexes=[],
+ use_rel_pos=True,
+ out_feature="last_feat",
+ use_act_checkpoint=True,
+ ),
+ in_feature="${.net.out_feature}",
+ out_channels=256,
+ scale_factors=(4.0, 2.0, 1.0, 0.5),
+ top_block=L(LastLevelMaxPool)(),
+ norm="LN",
+ square_pad=1024,
+)
+
+model.model_vision.neck = None
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+optimizer = get_config("common/optim.py").AdamW
+optimizer.params.lr_factor_func = (
+ lambda module_name: 0.1
+ if "reference_points" in module_name or "sampling_offsets" in module_name
+ else get_vit_lr_decay_rate(module_name, lr_decay_rate=0.8, num_layers=24)
+ if "backbone" in module_name
+ else 1
+)
+optimizer.params.overrides = {"pos_embed": {"weight_decay": 0.0}}
+
+optimizer.lr = 2e-4
+optimizer.weight_decay = 0.05
+
+train = get_config("common/train.py").train
+train.max_iter = 90000
+train.eval_period = 5000
+train.log_period = 20
+
+train.checkpointer.period = 5000
+train.checkpointer.max_to_keep = 2
+
+train.clip_grad.enabled = True
+train.clip_grad.params.max_norm = 0.1
+train.clip_grad.params.norm_type = 2
+
+train.device = "cuda"
+
+train.init_checkpoint = (
+ "detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_large.pth?matching_heuristics=True"
+)
+train.init_checkpoint = "models/MAE/mae_pretrain_vit_large.pth?matching_heuristics=True"
+
+train.amp.enabled = True
+train.ddp.fp16_compression = True
+
+lr_multiplier = get_config("common/coco_schedule.py").lr_multiplier_12ep
+lr_multiplier.scheduler.milestones = [75000, 90000]
+lr_multiplier.warmup_length = 1000 / train.max_iter
+
+dataloader.train.num_workers = 16
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = [16, 16]
+dataloader.train.mapper.image_format = "RGB"
+dataloader.train.mapper.use_instance_mask = True
+
+model.model_vision.dataset_tasks = ["name", "expression"]
+model.model_vision.dataset_names = ["coco_2017", "refcoco"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.output_dir = train.output_dir
+
+model.model_language = L(EVA01CLIP)(
+ clip_model="EVA_CLIP_g_14_X", cache_dir="models/BAAI/EVA/eva_clip_psz14.pt"
+)
+model.model_vision.embed_dim_language = 1024
diff --git a/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_12ep.py b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..74abeabb136a544b9a6ef2fb9084829412ed59b0
--- /dev/null
+++ b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_12ep.py
@@ -0,0 +1,20 @@
+from ...COCO_InstanceSegmentation.ape_deta.ape_deta_r50_12ep import (
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+from ...common.data.gqa_region_instance import dataloader
+
+model.model_vision.num_classes = 200
+
+model.model_vision.criterion[0].num_classes = 200
+
+dataloader.train.mapper.max_num_phrase = 100
+
+model.model_vision.dataset_prompts = ["phrase", "expression"]
+model.model_vision.dataset_names = ["gqa", "refcoco"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 1280
diff --git a/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw13.py b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw13.py
new file mode 100644
index 0000000000000000000000000000000000000000..2bc51482401207da941dce8bb6054359b5a4f9f3
--- /dev/null
+++ b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw13.py
@@ -0,0 +1,10 @@
+from ...common.data.odinw13_instance import dataloader
+from .ape_deta_r50_12ep import lr_multiplier, model, optimizer, train
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [
+ test.dataset.names.replace("_val", "") for test in dataloader.tests
+]
+model.model_vision.dataset_metas = [test.dataset.names for test in dataloader.tests]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw35.py b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw35.py
new file mode 100644
index 0000000000000000000000000000000000000000..fb0a68150e8b3a322c09b9535ca4bd447302c93f
--- /dev/null
+++ b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw35.py
@@ -0,0 +1,10 @@
+from ...common.data.odinw35_instance import dataloader
+from .ape_deta_r50_12ep import lr_multiplier, model, optimizer, train
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [
+ test.dataset.names.replace("_val", "") for test in dataloader.tests
+]
+model.model_vision.dataset_metas = [test.dataset.names for test in dataloader.tests]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep.py b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..d0f6e6d337b8483f9c94eb30774fbe4993b27fc2
--- /dev/null
+++ b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep.py
@@ -0,0 +1,46 @@
+from detectron2.config import LazyCall as L
+from omegaconf import OmegaConf
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+
+from .ape_deta_r50_12ep import dataloader, lr_multiplier, model, optimizer, train
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ cfg=OmegaConf.from_dotlist(
+ [
+ "MODEL.DYHEAD.FUSE_CONFIG.STABLE_SOFTMAX_2D=False",
+ "MODEL.DYHEAD.FUSE_CONFIG.CLAMP_MIN_FOR_UNDERFLOW=True",
+ "MODEL.DYHEAD.FUSE_CONFIG.CLAMP_MAX_FOR_OVERFLOW=True",
+ "MODEL.VL_FUSION_USE_CHECKPOINT=True",
+ ],
+ ),
+)
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 1280
diff --git a/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw13.py b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw13.py
new file mode 100644
index 0000000000000000000000000000000000000000..e017fae82e703156d858b0937ee3ae040620c634
--- /dev/null
+++ b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw13.py
@@ -0,0 +1,10 @@
+from ...common.data.odinw13_instance import dataloader
+from .ape_deta_r50_vlf_12ep import lr_multiplier, model, optimizer, train
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [
+ test.dataset.names.replace("_val", "") for test in dataloader.tests
+]
+model.model_vision.dataset_metas = [test.dataset.names for test in dataloader.tests]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw35.py b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw35.py
new file mode 100644
index 0000000000000000000000000000000000000000..e09309f978cbb10fdc0a2868c7eb7fb2c6045f72
--- /dev/null
+++ b/approach/ovod/APE/configs/GQA_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw35.py
@@ -0,0 +1,10 @@
+from ...common.data.odinw35_instance import dataloader
+from .ape_deta_r50_vlf_12ep import lr_multiplier, model, optimizer, train
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [
+ test.dataset.names.replace("_val", "") for test in dataloader.tests
+]
+model.model_vision.dataset_metas = [test.dataset.names for test in dataloader.tests]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_lsj1024_cp_180k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_lsj1024_cp_180k.py
new file mode 100644
index 0000000000000000000000000000000000000000..5af83887954d110c825dd952697d478b50ecd2fc
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_lsj1024_cp_180k.py
@@ -0,0 +1,21 @@
+from detectron2.config import LazyCall as L
+from detectron2.solver import WarmupParamScheduler
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from .ape_deta_vitl_eva02_lsj1024_cp_720k import dataloader, lr_multiplier, model, optimizer, train
+
+train.max_iter = 180000
+train.eval_period = 180000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[150000],
+ num_updates=180000,
+ ),
+ warmup_length=1000 / 180000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_lsj1024_cp_720k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_lsj1024_cp_720k.py
new file mode 100644
index 0000000000000000000000000000000000000000..769e70a4b2be02d65b7949bc180a2ca0b0140fd4
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_lsj1024_cp_720k.py
@@ -0,0 +1,83 @@
+from detectron2.config import LazyCall as L
+from detectron2.solver import WarmupParamScheduler
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+
+from ...common.data.lviscocococostuff_o365_oid_vgr_refcoco_group_by_image_panoptic_lsj1024_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(6)]
+for criterion, num_classes in zip(model.model_vision.criterion, [1256, 365, 601, 200, 200, 200]):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 100
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[4].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+model.model_vision.neck = None
+
+train.max_iter = 720000
+train.eval_period = 720000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[640000],
+ num_updates=720000,
+ ),
+ warmup_length=1000 / 720000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = [16, 16, 16, 16, 16]
+
+model.model_vision.dataset_prompts = ["name", "name", "name", "phrase", "phrase", "expression"]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "refcoco-mixed_group-by-image",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_1080k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_1080k.py
new file mode 100644
index 0000000000000000000000000000000000000000..a2202c06e3319d78825b4ac659be9c905720ce08
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_1080k.py
@@ -0,0 +1,27 @@
+from detectron2.config import LazyCall as L
+from detectron2.solver import WarmupParamScheduler
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from .ape_deta_vitl_eva02_vlf_lsj1024_cp_720k import (
+ dataloader,
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+
+train.max_iter = 1080000
+train.eval_period = 1080000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[900000],
+ num_updates=1080000,
+ ),
+ warmup_length=2000 / 1080000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_180k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_180k.py
new file mode 100644
index 0000000000000000000000000000000000000000..af32118d2a1cfe822478159a23ce04d2cfcdbad9
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_180k.py
@@ -0,0 +1,27 @@
+from detectron2.config import LazyCall as L
+from detectron2.solver import WarmupParamScheduler
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from .ape_deta_vitl_eva02_vlf_lsj1024_cp_720k import (
+ dataloader,
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+
+train.max_iter = 180000
+train.eval_period = 180000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[150000],
+ num_updates=180000,
+ ),
+ warmup_length=1000 / 180000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_720k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_720k.py
new file mode 100644
index 0000000000000000000000000000000000000000..06ecd91d10b077c563c66cd65de4ef7df91d551b
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_720k.py
@@ -0,0 +1,47 @@
+from detectron2.config import LazyCall as L
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+
+from .ape_deta_vitl_eva02_lsj1024_cp_720k import dataloader, lr_multiplier, model, optimizer, train
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 12800
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_08x8x270k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_08x8x270k.py
new file mode 100644
index 0000000000000000000000000000000000000000..fb64dc7385ee3182f35b480f59ce42b0db227daa
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_08x8x270k.py
@@ -0,0 +1,228 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 256, 1, 256, 256, 256, 256, 256]
+):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 128
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[2], 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 270000
+train.eval_period = 270000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[225000],
+ num_updates=270000,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 8
+dataloader.train.total_batch_size_list = [8, 8, 8, 8, 8, 8, 8, 8, 8]
+dataloader.train.num_workers = 2
+train.iter_size = 8
+
+dataloader.wait_group = 2
+dataloader.wait_time = 30 * 60
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_1080k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_1080k.py
new file mode 100644
index 0000000000000000000000000000000000000000..1ee51a4be70c9b40adca8e35022ba4350818aca1
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_1080k.py
@@ -0,0 +1,225 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 200, 1, 200, 200, 200, 200, 200]
+):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 100
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[2], 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 1080000
+train.eval_period = 1080000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[900000],
+ num_updates=1080000,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = [16, 16, 16, 16, 16, 16, 16, 16, 16]
+dataloader.train.num_workers = 4
+
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k.py
new file mode 100644
index 0000000000000000000000000000000000000000..ab66e17b3a35318a9964515f96db6744ec6163e6
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k.py
@@ -0,0 +1,227 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 256, 1, 256, 256, 256, 256, 256]
+):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 128
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[2], 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 1080000
+train.eval_period = 1080000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[900000],
+ num_updates=1080000,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = [16, 16, 16, 16, 16, 16, 16, 16, 16]
+dataloader.train.num_workers = 0
+train.iter_size = 4
+train.iter_loop = False
+
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k_mdl.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k_mdl.py
new file mode 100644
index 0000000000000000000000000000000000000000..e4a3774d0c871c29697296ca1dd9f36589661e24
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k_mdl.py
@@ -0,0 +1,230 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp_mdl import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 256, 1, 256, 256, 256, 256, 256]
+):
+ criterion.num_classes = num_classes
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train[0].dataset.names, 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train[2].dataset.names, 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 1080000
+train.eval_period = 1080000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[900000],
+ num_updates=1080000,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+for i in range(len(dataloader.train)):
+ dataloader.train[i].mapper.max_num_phrase = 128
+ dataloader.train[i].mapper.nms_thresh_phrase = 0.6
+ dataloader.train[i].total_batch_size = 16
+ dataloader.train[i].total_batch_size_list = [16]
+ dataloader.train[i].num_workers = 2
+
+train.iter_size = 4
+train.iter_loop = False
+train.dataset_ratio = [1, 1, 1, 1, 1, 0.1, 0.1, 0.1, 0.1]
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = [xx for x in dataloader.train for xx in x.dataset.names] + [
+ "refcoco-mixed"
+]
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k_mdl_llama2.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k_mdl_llama2.py
new file mode 100644
index 0000000000000000000000000000000000000000..d312bc379ce7bb8b38fc46f3a57d1fa24b7b8d75
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k_mdl_llama2.py
@@ -0,0 +1,235 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import Llama2
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp_mdl import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(Llama2)(
+ pretrained_model_name_or_path="models/meta-llama/Llama-2-7b-hf/",
+ dtype="float32",
+ vision_port="decoder",
+ eval_only=True,
+ load_in_4bit=True,
+ load_in_8bit=False,
+)
+model.model_vision.embed_dim_language = 4096
+model.model_vision.text_feature_reduce_type = "average"
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+model.model_vision.transformer.decoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 256, 1, 256, 256, 256, 256, 256]
+):
+ criterion.num_classes = num_classes
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train[0].dataset.names, 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train[2].dataset.names, 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 1080000
+train.eval_period = 1080000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[900000],
+ num_updates=1080000,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+for i in range(len(dataloader.train)):
+ dataloader.train[i].mapper.max_num_phrase = 128
+ dataloader.train[i].mapper.nms_thresh_phrase = 0.6
+ dataloader.train[i].total_batch_size = 16
+ dataloader.train[i].total_batch_size_list = [16]
+ dataloader.train[i].num_workers = 2
+
+train.iter_size = 4
+train.iter_loop = False
+train.dataset_ratio = [1, 1, 1, 1, 1, 0.1, 0.1, 0.1, 0.1]
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = [xx for x in dataloader.train for xx in x.dataset.names] + [
+ "refcoco-mixed"
+]
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x270k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x270k.py
new file mode 100644
index 0000000000000000000000000000000000000000..29857f7c0a37db22b2bfb61eb44b6d39dba1f8ef
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x270k.py
@@ -0,0 +1,227 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+ use_attention_mask_v=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 256, 1, 256, 256, 256, 256, 256]
+):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 128
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[2], 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 270000
+train.eval_period = 270000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[225000],
+ num_updates=270000,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = [16, 16, 16, 16, 16, 16, 16, 16, 16]
+dataloader.train.num_workers = 0
+train.iter_size = 4
+
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x270k_mdl.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x270k_mdl.py
new file mode 100644
index 0000000000000000000000000000000000000000..39b14d3cf95e1e3c97ac5cfa5509fb7ad09fd529
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x270k_mdl.py
@@ -0,0 +1,230 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp_mdl import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+ use_attention_mask_v=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 256, 1, 256, 256, 256, 256, 256]
+):
+ criterion.num_classes = num_classes
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train[0].dataset.names, 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train[2].dataset.names, 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 270000
+train.eval_period = 270000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[225000],
+ num_updates=270000,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+for i in range(len(dataloader.train)):
+ dataloader.train[i].mapper.max_num_phrase = 128
+ dataloader.train[i].mapper.nms_thresh_phrase = 0.6
+ dataloader.train[i].total_batch_size = 16
+ dataloader.train[i].total_batch_size_list = [16]
+ dataloader.train[i].num_workers = 2
+
+train.iter_size = 4
+train.dataset_ratio = [1, 1, 1, 1, 1, 0.1, 0.1, 0.1, 0.1]
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = [xx for x in dataloader.train for xx in x.dataset.names] + [
+ "refcoco-mixed"
+]
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x270k_mdl_llama2.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x270k_mdl_llama2.py
new file mode 100644
index 0000000000000000000000000000000000000000..8f40027bf3381afffcb8d159f98ae33a1e361d6a
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x270k_mdl_llama2.py
@@ -0,0 +1,235 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import Llama2
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp_mdl import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(Llama2)(
+ pretrained_model_name_or_path="models/meta-llama/Llama-2-7b-hf/",
+ dtype="float32",
+ vision_port="decoder",
+ eval_only=True,
+ load_in_4bit=True,
+ load_in_8bit=False,
+)
+model.model_vision.embed_dim_language = 4096
+model.model_vision.text_feature_reduce_type = "average"
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+ use_attention_mask_v=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+model.model_vision.transformer.decoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 256, 1, 256, 256, 256, 256, 256]
+):
+ criterion.num_classes = num_classes
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train[0].dataset.names, 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train[2].dataset.names, 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 270000
+train.eval_period = 270000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[225000],
+ num_updates=270000,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+for i in range(len(dataloader.train)):
+ dataloader.train[i].mapper.max_num_phrase = 128
+ dataloader.train[i].mapper.nms_thresh_phrase = 0.6
+ dataloader.train[i].total_batch_size = 16
+ dataloader.train[i].total_batch_size_list = [16]
+ dataloader.train[i].num_workers = 2
+
+train.iter_size = 4
+train.dataset_ratio = [1, 1, 1, 1, 1, 0.1, 0.1, 0.1, 0.1]
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = [xx for x in dataloader.train for xx in x.dataset.names] + [
+ "refcoco-mixed"
+]
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x337k_mdl.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x337k_mdl.py
new file mode 100644
index 0000000000000000000000000000000000000000..b746718093c4564c4a1197c21f976d7b6fe9e33f
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4x337k_mdl.py
@@ -0,0 +1,230 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp_mdl import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+ use_attention_mask_v=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 256, 1, 256, 256, 256, 256, 256]
+):
+ criterion.num_classes = num_classes
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train[0].dataset.names, 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train[2].dataset.names, 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 337500
+train.eval_period = 337500
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1, 0.01],
+ milestones=[225000, 300000],
+ num_updates=337500,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+for i in range(len(dataloader.train)):
+ dataloader.train[i].mapper.max_num_phrase = 128
+ dataloader.train[i].mapper.nms_thresh_phrase = 0.6
+ dataloader.train[i].total_batch_size = 16
+ dataloader.train[i].total_batch_size_list = [16]
+ dataloader.train[i].num_workers = 2
+
+train.iter_size = 4
+train.dataset_ratio = [1, 1, 1, 1, 1, 0.1, 0.1, 0.1, 0.1]
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = [xx for x in dataloader.train for xx in x.dataset.names] + [
+ "refcoco-mixed"
+]
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_32x2x270k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_32x2x270k.py
new file mode 100644
index 0000000000000000000000000000000000000000..a4db1c343222467a7301e4eeece44102a05b7407
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_32x2x270k.py
@@ -0,0 +1,228 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 256, 1, 256, 256, 256, 256, 256]
+):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 128
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[2], 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 270000
+train.eval_period = 270000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[225000],
+ num_updates=270000,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 32
+dataloader.train.total_batch_size_list = [32, 32, 32, 32, 32, 32, 32, 32, 32]
+dataloader.train.num_workers = 2
+train.iter_size = 2
+
+dataloader.wait_group = 2
+dataloader.wait_time = 30 * 60
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_48x2x270k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_48x2x270k.py
new file mode 100644
index 0000000000000000000000000000000000000000..00f04e1673863920eae6a008b0c259d4b86cc7d2
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_48x2x270k.py
@@ -0,0 +1,225 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 200, 1, 200, 200, 200, 200, 200]
+):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 100
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[2], 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 270000 * 2
+train.eval_period = 270000 * 2
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[225000 * 2],
+ num_updates=270000 * 2,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 48
+dataloader.train.total_batch_size_list = [48, 48, 48, 48, 48, 48, 48, 48, 48]
+dataloader.train.num_workers = 2
+train.iter_size = 2
+
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_64x1x270k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_64x1x270k.py
new file mode 100644
index 0000000000000000000000000000000000000000..76bd25635603af44a66349479e05a4da588ae54d
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_64x1x270k.py
@@ -0,0 +1,228 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 256, 1, 256, 256, 256, 256, 256]
+):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 128
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[2], 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 270000
+train.eval_period = 270000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[225000],
+ num_updates=270000,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 64
+dataloader.train.total_batch_size_list = [64, 64, 64, 64, 64, 64, 64, 64, 64]
+dataloader.train.num_workers = 2
+train.iter_size = 1
+
+dataloader.wait_group = 2
+dataloader.wait_time = 30 * 60
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1536_cp_08x8x270k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1536_cp_08x8x270k.py
new file mode 100644
index 0000000000000000000000000000000000000000..fdd05d6e4acf94bd6faee56befbd33d9b0d88afd
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1536_cp_08x8x270k.py
@@ -0,0 +1,225 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip_1536 import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1536_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+model.model_vision.transformer.decoder.use_act_checkpoint = True
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 200, 1, 200, 200, 200, 200, 200]
+):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 100
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[2], 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 270000 * 8
+train.eval_period = 270000 * 8
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[225000 * 8],
+ num_updates=270000 * 8,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 8
+dataloader.train.total_batch_size_list = [8, 8, 8, 8, 8, 8, 8, 8, 8]
+train.iter_size = 8
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1536_cp_32x2x270k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1536_cp_32x2x270k.py
new file mode 100644
index 0000000000000000000000000000000000000000..7c5265d8e8b86620ae3090db34dfca9e817772f6
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1536_cp_32x2x270k.py
@@ -0,0 +1,222 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip_1536 import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1536_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 9
+model.model_vision.transformer.decoder.num_layers = 9
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 200, 1, 200, 200, 200, 200, 200]
+):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 100
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[2], 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 270000 * 2
+train.eval_period = 270000 * 2
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[225000 * 2],
+ num_updates=270000 * 2,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 32
+dataloader.train.total_batch_size_list = [32, 32, 32, 32, 32, 32, 32, 32, 32]
+train.iter_size = 2
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1536_cp_64x270k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1536_cp_64x270k.py
new file mode 100644
index 0000000000000000000000000000000000000000..49a00e1e0c73abb764b71ef08f49df228ab89cbb
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1536_cp_64x270k.py
@@ -0,0 +1,222 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.solver import WarmupParamScheduler
+from detrex.modeling.neck import ChannelMapper
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip_1536 import backbone
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1536_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 9
+model.model_vision.transformer.decoder.num_layers = 9
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 200, 1, 200, 200, 200, 200, 200]
+):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 100
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[2], 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 270000
+train.eval_period = 270000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[225000],
+ num_updates=270000,
+ ),
+ warmup_length=2000 / 270000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 64
+dataloader.train.total_batch_size_list = [64, 64, 64, 64, 64, 64, 64, 64, 64]
+
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_1080k.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_1080k.py
new file mode 100644
index 0000000000000000000000000000000000000000..ff47d95471a2985bed72e5f6f89f314ac9c928ef
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_1080k.py
@@ -0,0 +1,173 @@
+from detectron2.config import LazyCall as L
+from detectron2.solver import WarmupParamScheduler
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+
+from ...common.data.lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp import (
+ dataloader,
+)
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+del criterion.fed_loss_num_classes
+model.model_vision.criterion = [criterion for _ in range(10)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion, [1256, 365, 601, 200, 1, 200, 200, 200, 200, 200]
+):
+ criterion.num_classes = num_classes
+
+dataloader.train.mapper.max_num_phrase = 100
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[2].use_fed_loss = True
+model.model_vision.criterion[2].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[2], 0.5
+)
+model.model_vision.criterion[2].fed_loss_num_classes = 50
+model.model_vision.criterion[2].fed_loss_pad_type = "cat"
+
+model.model_vision.criterion[3].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[3].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[3].weight_dict.update({k: 0.0})
+
+for k, v in model.model_vision.criterion[4].weight_dict.items():
+ if "_class" in k and "_enc" not in k:
+ model.model_vision.criterion[4].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+model.model_vision.criterion[6].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[6].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[6].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[7].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[7].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[7].weight_dict.update({k: 0.0})
+
+model.model_vision.criterion[8].weight_dict["loss_class_enc"] = 0.0
+for k, v in model.model_vision.criterion[8].weight_dict.items():
+ if "_enc" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+ if "_bbox" in k or "_giou" in k or "_dice" in k or "_mask" in k:
+ model.model_vision.criterion[8].weight_dict.update({k: 0.0})
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = 0.9
+model.model_vision.transformer.proposal_ambiguous = 1
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 1080000
+train.eval_period = 1080000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[900000],
+ num_updates=1080000,
+ ),
+ warmup_length=2000 / 1080000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = [16, 16, 16, 16, 16, 16, 16, 16, 16]
+dataloader.train.num_workers = 4
+
+model.model_vision.dataset_prompts = [
+ "name",
+ "name",
+ "name",
+ "phrase",
+ "name",
+ "phrase",
+ "phrase",
+ "phrase",
+ "phrase",
+ "expression",
+]
+model.model_vision.dataset_names = [
+ "lvis+stuffonly",
+ "objects365",
+ "openimages",
+ "vgregion",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa",
+ "phrasecut",
+ "flickr30k",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_PanopticSegmentation/ape_deta/ape_deta_r50_lsj1024_cp_50ep.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_PanopticSegmentation/ape_deta/ape_deta_r50_lsj1024_cp_50ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..d28db18c4a401bb634d8f24ae12f4a4b63ba44dd
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_PanopticSegmentation/ape_deta/ape_deta_r50_lsj1024_cp_50ep.py
@@ -0,0 +1,36 @@
+from detectron2.data.detection_utils import get_fed_loss_cls_weights
+from detrex.config import get_config
+
+from ...common.data.lviscocococostuff_panoptic_lsj1024_cp import dataloader
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_r50_24ep import (
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.num_classes = 1256
+model.model_vision.criterion[0].num_classes = 1256
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names, 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+model.model_vision.criterion[0].fed_loss_pad_type = "cat"
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+train.max_iter = 375000
+train.eval_period = 20000
+
+lr_multiplier = get_config("common/coco_schedule.py").lr_multiplier_50ep
+
+dataloader.train.total_batch_size = 16
+
+model.model_vision.dataset_prompts = ["name"]
+model.model_vision.dataset_names = ["lvis+stuffonly"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_lsj1024_cp_24ep.py b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_lsj1024_cp_24ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..c0b4e6e42920a5a13b7585b12dcf28d1b5a6c84a
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCOCOCOSTUFF_PanopticSegmentation/ape_deta/ape_deta_vitl_eva02_lsj1024_cp_24ep.py
@@ -0,0 +1,20 @@
+from ...common.data.lviscocococostuff_panoptic_lsj1024_cp import dataloader
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.num_classes = 1256
+model.model_vision.criterion[0].num_classes = 1256
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+model.model_vision.dataset_prompts = ["name"]
+model.model_vision.dataset_names = ["lvis+stuffonly"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCO_COCOSTUFF_O365_OID_VG_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_180k.py b/approach/ovod/APE/configs/LVISCOCO_COCOSTUFF_O365_OID_VG_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_180k.py
new file mode 100644
index 0000000000000000000000000000000000000000..af32118d2a1cfe822478159a23ce04d2cfcdbad9
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCO_COCOSTUFF_O365_OID_VG_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_180k.py
@@ -0,0 +1,27 @@
+from detectron2.config import LazyCall as L
+from detectron2.solver import WarmupParamScheduler
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from .ape_deta_vitl_eva02_vlf_lsj1024_cp_720k import (
+ dataloader,
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+
+train.max_iter = 180000
+train.eval_period = 180000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[150000],
+ num_updates=180000,
+ ),
+ warmup_length=1000 / 180000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVISCOCO_COCOSTUFF_O365_OID_VG_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_720k.py b/approach/ovod/APE/configs/LVISCOCO_COCOSTUFF_O365_OID_VG_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_720k.py
new file mode 100644
index 0000000000000000000000000000000000000000..1405c871297d1efa37ec61e2c686296c91ef109a
--- /dev/null
+++ b/approach/ovod/APE/configs/LVISCOCO_COCOSTUFF_O365_OID_VG_REFCOCO/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_cp_720k.py
@@ -0,0 +1,120 @@
+import random
+
+from detectron2.config import LazyCall as L
+from detectron2.solver import WarmupParamScheduler
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.data.samplers import MultiDatasetTrainingSampler
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+
+from ...common.data.lviscoco_cocostuff_o365_oid_vg_refcoco_panoptic_lsj1024_cp import dataloader
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=False,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+
+model.model_vision.text_feature_bank = True
+
+model.model_vision.num_classes = 1203
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+model.model_vision.criterion = [criterion for _ in range(6)]
+for criterion, num_classes in zip(model.model_vision.criterion, [1203, 54, 365, 601, 150, 200]):
+ criterion.num_classes = num_classes
+
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+
+model.model_vision.criterion[5].weight_dict["loss_class_enc"] = 0.0
+
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+model.model_vision.neck = None
+
+train.max_iter = 720000
+train.eval_period = 720000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[640000],
+ num_updates=720000,
+ ),
+ warmup_length=1000 / 720000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = [16, 16, 16, 16, 16]
+
+model.model_vision.dataset_prompts = ["name", "name", "name", "name", "name", "expression"]
+model.model_vision.dataset_names = [
+ "lvis",
+ "stuffonly",
+ "objects365",
+ "openimages",
+ "visualgenome",
+ "refcoco",
+]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+train.output_dir = "output/" + __file__[:-3]
+
+dataloader.train.sampler = lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=6,
+ dataset_ratio=[1, 1, 1, 1, 1, 0],
+ use_rfs=[True, False, True, True, True, True],
+ use_cas=[False, False, False, False, False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+)
diff --git a/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep.py b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..df956aebd64affce77d3ade6a1d0b2bb1f25018e
--- /dev/null
+++ b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep.py
@@ -0,0 +1,29 @@
+from detectron2.data.detection_utils import get_fed_loss_cls_weights
+from detrex.config import get_config
+
+from ...COCO_SA1B_InstanceSegmentation.ape_deta.ape_deta_r50_24ep import model, optimizer, train
+
+from ...common.data.lvis_sa1b_instance import dataloader
+
+model.model_vision.num_classes = 1203
+model.model_vision.criterion[0].num_classes = 1203
+model.model_vision.select_box_nums_for_evaluation = 300
+model.model_vision.criterion[0].use_fed_loss = True
+model.model_vision.criterion[0].get_fed_loss_cls_weights = lambda: get_fed_loss_cls_weights(
+ dataloader.train.dataset.names[0], 0.5
+)
+model.model_vision.criterion[0].fed_loss_num_classes = 50
+
+model.model_vision.semantic_on = False
+model.model_vision.panoptic_on = False
+
+train.max_iter = 375000
+train.eval_period = 20000
+
+lr_multiplier = get_config("common/coco_schedule.py").lr_multiplier_50ep
+
+model.model_vision.dataset_prompts = ["name", "name"]
+model.model_vision.dataset_names = ["lvis", "sa1b"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_eval_odinw13.py b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_eval_odinw13.py
new file mode 100644
index 0000000000000000000000000000000000000000..e8850dcd4cd87feae49f1b185384e79e68e8cfab
--- /dev/null
+++ b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_eval_odinw13.py
@@ -0,0 +1,10 @@
+from ...common.data.odinw13_instance import dataloader
+from .ape_deta_r50_50ep import lr_multiplier, model, optimizer, train
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [
+ test.dataset.names.replace("_val", "") for test in dataloader.tests
+]
+model.model_vision.dataset_metas = [test.dataset.names for test in dataloader.tests]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_eval_odinw35.py b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_eval_odinw35.py
new file mode 100644
index 0000000000000000000000000000000000000000..47bc758015460dfb97f9f830fb125529488ae74c
--- /dev/null
+++ b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_eval_odinw35.py
@@ -0,0 +1,10 @@
+from ...common.data.odinw35_instance import dataloader
+from .ape_deta_r50_50ep import lr_multiplier, model, optimizer, train
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [
+ test.dataset.names.replace("_val", "") for test in dataloader.tests
+]
+model.model_vision.dataset_metas = [test.dataset.names for test in dataloader.tests]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_eval_seginw.py b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_eval_seginw.py
new file mode 100644
index 0000000000000000000000000000000000000000..d51d5d6cc9230e02a7bda531151c5c9d382bec5e
--- /dev/null
+++ b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_eval_seginw.py
@@ -0,0 +1,11 @@
+from ...common.data.seginw_instance import dataloader
+from .ape_deta_r50_50ep import lr_multiplier, model, optimizer, train
+
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [
+ test.dataset.names.replace("_val", "") for test in dataloader.tests
+]
+model.model_vision.dataset_metas = [test.dataset.names for test in dataloader.tests]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_iouloss_lp.py b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_iouloss_lp.py
new file mode 100644
index 0000000000000000000000000000000000000000..772782020ef8962eff7d11fe546f8428591c7d50
--- /dev/null
+++ b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_iouloss_lp.py
@@ -0,0 +1,21 @@
+from ape.modeling.ape_deta import Stage1Assigner_loc, Stage2Assigner_loc
+
+from .ape_deta_r50_50ep import dataloader, lr_multiplier, model, optimizer, train
+
+model.model_vision.criterion[0].losses += ["pred_iou"]
+model.model_vision.criterion[0].weight_dict["loss_iou"] = 1.0
+
+model.model_vision.last_class_embed_use_mlp = True
+model.model_vision.transformer.pre_nms_topk = 1000
+model.model_vision.transformer.nms_thresh_enc = 0.9
+
+model.model_vision.criterion[0].matcher_stage1.update(
+ _target_=Stage1Assigner_loc,
+)
+model.model_vision.criterion[1].matcher_stage1.update(
+ _target_=Stage1Assigner_loc,
+)
+
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 1280
diff --git a/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_mp.py b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_mp.py
new file mode 100644
index 0000000000000000000000000000000000000000..ba8c845cf97e5764d605d2d1528c093cec4aab34
--- /dev/null
+++ b/approach/ovod/APE/configs/LVIS_SA1B_InstanceSegmentation/ape_deta/ape_deta_r50_50ep_mp.py
@@ -0,0 +1,7 @@
+from .ape_deta_r50_50ep import dataloader, lr_multiplier, model, optimizer, train
+
+model.model_vision.transformer.proposal_ambiguous = 1
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 12800
diff --git a/approach/ovod/APE/configs/PascalVOC20_SemanticSegmentation/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024.py b/approach/ovod/APE/configs/PascalVOC20_SemanticSegmentation/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..56dbd7be1b3f47989b890e7cb54856919f523b76
--- /dev/null
+++ b/approach/ovod/APE/configs/PascalVOC20_SemanticSegmentation/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024.py
@@ -0,0 +1,100 @@
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detrex.modeling.neck import ChannelMapper
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from .ape_deta_vitl_eva02_lsj1024 import dataloader, lr_multiplier, model, optimizer, train
+
+model.model_vision.backbone = backbone
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.neck = L(ChannelMapper)(
+ input_shapes={
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+ },
+ in_features=["p2", "p3", "p4", "p5", "p6"],
+ out_channels=256,
+ num_outs=5,
+ kernel_size=1,
+ norm_layer=L(nn.GroupNorm)(num_groups=32, num_channels=256),
+)
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+model.model_vision.transformer.encoder.num_layers = 6
+model.model_vision.transformer.decoder.num_layers = 6
+model.model_vision.transformer.encoder.embed_dim = 256
+model.model_vision.transformer.decoder.embed_dim = 256
+model.model_vision.embed_dim = 256
+model.model_vision.backbone.out_channels = 256
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = -1.0
+model.model_vision.transformer.proposal_ambiguous = 1
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 12800
diff --git a/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_r50_12ep.py b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_r50_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..6c0e8174f74bec3fd16b0f0954246fdd9f971f61
--- /dev/null
+++ b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_r50_12ep.py
@@ -0,0 +1,27 @@
+from ...COCO_InstanceSegmentation.ape_deta.ape_deta_r50_12ep import (
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+
+from ...common.data.refcoco_group_by_image_instance import dataloader
+
+model.model_vision.num_classes = 256
+
+model.model_vision.select_box_nums_for_evaluation = 1
+
+criterion = model.model_vision.criterion[0]
+model.model_vision.criterion = [criterion for _ in range(2)]
+
+model.model_vision.dataset_prompts = ["phrase", "expression"]
+model.model_vision.dataset_names = ["refcoco-mixed_group-by-image", "refcoco"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_r50_bert_vlf_12ep.py b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_r50_bert_vlf_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..9040f845a934004a80adfaff666ceaeb0d474a7f
--- /dev/null
+++ b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_r50_bert_vlf_12ep.py
@@ -0,0 +1,32 @@
+from detectron2.config import LazyCall as L
+from ape.modeling.text import Bert
+
+from ...common.data.refcoco_instance import dataloader
+from .ape_deta_r50_vlf_12ep import lr_multiplier, model, optimizer, train
+
+model.model_vision.num_classes = 1
+model.model_vision.select_box_nums_for_evaluation = 1
+
+model.model_vision.criterion[0].num_classes = 1
+criterion = model.model_vision.criterion[0]
+model.model_vision.criterion = [criterion for _ in range(2)]
+
+model.model_vision.dataset_prompts = ["expression"]
+model.model_vision.dataset_names = ["refcoco"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+
+model.model_language = L(Bert)(
+ pretrained_model_name_or_path="models/huggingface/bert-base-uncased/"
+)
+model.model_vision.embed_dim_language = 768
+model.model_vision.text_feature_reduce_type = "average"
+
+model.model_vision.text_feature_bank = False
+model.model_vision.text_feature_reduce_before_fusion = False
+model.model_vision.text_feature_batch_repeat = False
+model.model_vision.expression_cumulative_gt_class = False
+
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep.py b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..5a456e63d5cb956c2ad6eefedb5d8fa39526650d
--- /dev/null
+++ b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep.py
@@ -0,0 +1,48 @@
+from detectron2.config import LazyCall as L
+from omegaconf import OmegaConf
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+
+from .ape_deta_r50_12ep import dataloader, lr_multiplier, model, optimizer, train
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+ use_attention_mask_v=True,
+)
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_eva02_clip_lsj1024_12ep.py b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_eva02_clip_lsj1024_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..2367609e21e2876a3808c23045f8defc5ad0c9e3
--- /dev/null
+++ b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_eva02_clip_lsj1024_12ep.py
@@ -0,0 +1,104 @@
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.model_zoo import get_config as get_config_d2
+from detectron2.modeling.backbone.fpn import LastLevelMaxPool
+from detrex.config import get_config as get_config_detrex
+from ape.modeling.backbone.vit import get_vit_lr_decay_rate
+from ape.modeling.backbone.vit_eva02 import SimpleFeaturePyramid, ViT
+from ape.modeling.text import EVA02CLIP
+
+from ...common.backbone.vitl_eva02_clip import backbone
+from ...common.data.refcoco_instance_lsj1024 import dataloader
+from .ape_deta_r50_12ep import model
+
+constants = get_config_d2("common/data/constants.py").constants
+
+model.model_vision.pixel_mean = constants.imagenet_rgb256_mean
+model.model_vision.pixel_std = constants.imagenet_rgb256_std
+model.model_vision.input_format = "RGB"
+
+model.model_vision.backbone = backbone
+
+model.model_vision.neck.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+model.model_vision.neck.in_features = ["p2", "p3", "p4", "p5", "p6"]
+model.model_vision.neck.num_outs = 5
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+optimizer = get_config_detrex("common/optim.py").AdamW
+optimizer.params.lr_factor_func = (
+ lambda module_name: 0.1
+ if "reference_points" in module_name or "sampling_offsets" in module_name
+ else get_vit_lr_decay_rate(module_name, lr_decay_rate=0.8, num_layers=24)
+ if "backbone.net" in module_name
+ else 1
+)
+optimizer.params.overrides = {"pos_embed": {"weight_decay": 0.0}}
+optimizer.params.weight_decay_norm = None
+
+optimizer.lr = 2e-4
+optimizer.weight_decay = 1e-4
+
+train = get_config_detrex("common/train.py").train
+train.max_iter = 90000
+train.eval_period = 5000
+train.log_period = 20
+
+train.checkpointer.period = 5000
+train.checkpointer.max_to_keep = 2
+
+train.clip_grad.enabled = True
+train.clip_grad.params.max_norm = 0.1
+train.clip_grad.params.norm_type = 2
+
+train.device = "cuda"
+
+train.init_checkpoint = (
+ "models/QuanSun/EVA-CLIP/EVA02_CLIP_L_336_psz14to16_s6B.pt?matching_heuristics=True"
+)
+
+train.amp.enabled = True
+train.ddp.fp16_compression = True
+
+lr_multiplier = get_config_detrex("common/coco_schedule.py").lr_multiplier_12ep
+lr_multiplier.scheduler.milestones = [75000, 90000]
+lr_multiplier.warmup_length = 1000 / train.max_iter
+
+dataloader.train.num_workers = 16
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = ["${..total_batch_size}", "${..total_batch_size}"]
+dataloader.train.mapper.image_format = "RGB"
+dataloader.train.mapper.use_instance_mask = True
+
+model.model_vision.dataset_prompts = ["expression"]
+model.model_vision.dataset_names = ["refcoco"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.output_dir = train.output_dir
+
+model.model_language = L(EVA02CLIP)(
+ clip_model="EVA02-CLIP-bigE-14-plus",
+ cache_dir="models/QuanSun/EVA-CLIP/EVA02_CLIP_E_psz14_plus_s9B.pt",
+ dtype="float16",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+
diff --git a/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_12ep.py b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..01ed3f740eaadc2effb4c671f1c7daf3f3744eac
--- /dev/null
+++ b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_12ep.py
@@ -0,0 +1,54 @@
+from detectron2.config import LazyCall as L
+from omegaconf import OmegaConf
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+
+from .ape_deta_vitl_eva02_clip_lsj1024_12ep import (
+ dataloader,
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+ use_attention_mask_v=True,
+)
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 5120
diff --git a/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_12ep.py b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..ddbeaec0d9c98866627df67b9d372943ece023b6
--- /dev/null
+++ b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024_12ep.py
@@ -0,0 +1,105 @@
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.model_zoo import get_config as get_config_d2
+from detectron2.modeling.backbone.fpn import LastLevelMaxPool
+from detrex.config import get_config as get_config_detrex
+from ape.modeling.backbone.vit import get_vit_lr_decay_rate
+from ape.modeling.backbone.vit_eva02 import SimpleFeaturePyramid, ViT
+from ape.modeling.text import EVA01CLIP
+
+from ...common.backbone.vitl_eva02 import backbone
+
+from ...common.data.refcoco_group_by_image_instance_lsj1024 import dataloader
+from .ape_deta_r50_vlf_12ep import model
+
+model.model_vision.num_classes = 256
+model.model_vision.select_box_nums_for_evaluation = 1
+model.model_vision.criterion[0].num_classes = 256
+model.model_vision.criterion[1].num_classes = 256
+
+constants = get_config_d2("common/data/constants.py").constants
+
+model.model_vision.pixel_mean = constants.imagenet_rgb256_mean
+model.model_vision.pixel_std = constants.imagenet_rgb256_std
+model.model_vision.input_format = "RGB"
+
+model.model_vision.backbone = backbone
+
+model.model_vision.neck = None
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+optimizer = get_config_detrex("common/optim.py").AdamW
+optimizer.params.lr_factor_func = (
+ lambda module_name: 0.1
+ if "reference_points" in module_name or "sampling_offsets" in module_name
+ else get_vit_lr_decay_rate(module_name, lr_decay_rate=0.8, num_layers=24)
+ if "backbone.net" in module_name
+ else 1
+)
+optimizer.params.overrides = {"pos_embed": {"weight_decay": 0.0}}
+optimizer.params.weight_decay_norm = None
+
+optimizer.lr = 2e-4
+optimizer.weight_decay = 1e-4
+
+train = get_config_detrex("common/train.py").train
+train.max_iter = 90000
+train.eval_period = 5000
+train.log_period = 20
+
+train.checkpointer.period = 5000
+train.checkpointer.max_to_keep = 2
+
+train.clip_grad.enabled = True
+train.clip_grad.params.max_norm = 0.1
+train.clip_grad.params.norm_type = 2
+
+train.device = "cuda"
+
+train.init_checkpoint = (
+ "models/Yunxin-CV/EVA-02/eva02/pt/eva02_L_pt_in21k_p14to16.pt?matching_heuristics=True"
+)
+
+train.amp.enabled = True
+train.ddp.fp16_compression = True
+
+lr_multiplier = get_config_detrex("common/coco_schedule.py").lr_multiplier_12ep
+lr_multiplier.scheduler.milestones = [75000, 90000]
+lr_multiplier.warmup_length = 1000 / train.max_iter
+
+dataloader.train.num_workers = 16
+dataloader.train.total_batch_size = 16
+dataloader.train.total_batch_size_list = ["${..total_batch_size}", "${..total_batch_size}"]
+dataloader.train.mapper.image_format = "RGB"
+dataloader.train.mapper.use_instance_mask = True
+
+dataloader.train.mapper.max_num_phrase = 128
+dataloader.train.mapper.nms_thresh_phrase = 0.6
+
+model.model_vision.dataset_prompts = ["phrase", "expression"]
+model.model_vision.dataset_names = ["refcoco-mixed_group-by-image", "refcoco"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+model.model_language = L(EVA01CLIP)(
+ clip_model="EVA_CLIP_g_14_X",
+ cache_dir="models/BAAI/EVA/eva_clip_psz14.pt",
+)
+model.model_vision.embed_dim_language = 1024
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+
+model.model_vision.transformer.encoder.use_act_checkpoint = True
+model.model_vision.transformer.decoder.use_act_checkpoint = True
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_lsj1024_12ep.py b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_lsj1024_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..18683f6bdee2e6d7e8e36f2d3d37cda7273c4e07
--- /dev/null
+++ b/approach/ovod/APE/configs/REFCOCO_VisualGrounding/ape_deta/ape_deta_vitl_lsj1024_12ep.py
@@ -0,0 +1,115 @@
+from functools import partial
+
+import torch.nn as nn
+
+from detectron2.config import LazyCall as L
+from detectron2.layers import ShapeSpec
+from detectron2.model_zoo import get_config as get_config_d2
+from detectron2.modeling.backbone.fpn import LastLevelMaxPool
+from detectron2.modeling.backbone.vit import SimpleFeaturePyramid, ViT
+from detrex.config import get_config as get_config_detrex
+from ape.modeling.backbone.vit import get_vit_lr_decay_rate
+from ape.modeling.text import EVA01CLIP
+
+from ...common.data.refcoco_instance_lsj1024 import dataloader
+from .ape_deta_r50_vlf_12ep import model
+
+constants = get_config_d2("common/data/constants.py").constants
+model.model_vision.pixel_mean = constants.imagenet_rgb256_mean
+model.model_vision.pixel_std = constants.imagenet_rgb256_std
+model.model_vision.input_format = "RGB"
+
+model.model_vision.backbone = L(SimpleFeaturePyramid)(
+ net=L(ViT)( # Single-scale ViT backbone
+ img_size=1024,
+ patch_size=16,
+ embed_dim=1024,
+ depth=24,
+ num_heads=16,
+ drop_path_rate=0.4,
+ window_size=14,
+ mlp_ratio=4,
+ norm_layer=partial(nn.LayerNorm, eps=1e-6),
+ window_block_indexes=list(range(0, 5))
+ + list(range(6, 11))
+ + list(range(12, 17))
+ + list(range(18, 23)),
+ residual_block_indexes=[],
+ use_rel_pos=True,
+ out_feature="last_feat",
+ use_act_checkpoint=True,
+ ),
+ in_feature="${.net.out_feature}",
+ out_channels=256,
+ scale_factors=(4.0, 2.0, 1.0, 0.5),
+ top_block=L(LastLevelMaxPool)(),
+ norm="LN",
+ square_pad=1024,
+)
+
+model.model_vision.neck = None
+
+model.model_vision.mask_in_features = ["p2"]
+model.model_vision.input_shapes = {
+ "p2": ShapeSpec(channels=256),
+ "p3": ShapeSpec(channels=256),
+ "p4": ShapeSpec(channels=256),
+ "p5": ShapeSpec(channels=256),
+ "p6": ShapeSpec(channels=256),
+}
+
+optimizer = get_config_detrex("common/optim.py").AdamW
+optimizer.params.lr_factor_func = (
+ lambda module_name: 0.1
+ if "reference_points" in module_name or "sampling_offsets" in module_name
+ else get_vit_lr_decay_rate(module_name, lr_decay_rate=0.8, num_layers=24)
+ if "backbone.net" in module_name
+ else 1
+)
+optimizer.params.overrides = {"pos_embed": {"weight_decay": 0.0}}
+
+optimizer.lr = 2e-4
+optimizer.weight_decay = 0.05
+
+train = get_config_detrex("common/train.py").train
+train.max_iter = 90000
+train.eval_period = 5000
+train.log_period = 20
+
+train.checkpointer.period = 5000
+train.checkpointer.max_to_keep = 2
+
+train.clip_grad.enabled = True
+train.clip_grad.params.max_norm = 0.1
+train.clip_grad.params.norm_type = 2
+
+train.device = "cuda"
+
+train.init_checkpoint = (
+ "detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_large.pth?matching_heuristics=True"
+)
+train.init_checkpoint = "models/MAE/mae_pretrain_vit_large.pth?matching_heuristics=True"
+
+train.amp.enabled = True
+train.ddp.fp16_compression = True
+
+lr_multiplier = get_config_detrex("common/coco_schedule.py").lr_multiplier_12ep
+lr_multiplier.scheduler.milestones = [75000, 90000]
+lr_multiplier.warmup_length = 1000 / train.max_iter
+
+dataloader.train.num_workers = 16
+dataloader.train.total_batch_size = 16
+dataloader.train.mapper.image_format = "RGB"
+dataloader.train.mapper.use_instance_mask = True
+
+model.model_vision.dataset_prompts = ["expression"]
+model.model_vision.dataset_names = ["refcoco"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.output_dir = train.output_dir
+
+model.model_language = L(EVA01CLIP)(
+ clip_model="EVA_CLIP_g_14_X", cache_dir="models/BAAI/EVA/eva_clip_psz14.pt"
+)
+model.model_vision.embed_dim_language = 1024
diff --git a/approach/ovod/APE/configs/SegInW_InstanceSegmentation/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024.py b/approach/ovod/APE/configs/SegInW_InstanceSegmentation/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..93721474e19084f32713e3d687fd8894fef93b82
--- /dev/null
+++ b/approach/ovod/APE/configs/SegInW_InstanceSegmentation/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024.py
@@ -0,0 +1,108 @@
+from detectron2.config import LazyCall as L
+from detectron2.solver import WarmupParamScheduler
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+
+from ...common.data.seginw_instance_lsj1024 import dataloader
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_clip_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+model.model_vision.criterion = [criterion for _ in range(25)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion,
+ [
+ 1000,
+ ]
+ * 25,
+):
+ criterion.num_classes = num_classes
+
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = -1.0
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+
+train.max_iter = 720000
+train.eval_period = 720000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[640000],
+ num_updates=720000,
+ ),
+ warmup_length=1000 / 720000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+for i in range(len(dataloader.train)):
+ dataloader.train[i].total_batch_size = 16
+ dataloader.train[i].total_batch_size_list = [16]
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [x.dataset.names.replace("_val", "") for x in dataloader.tests]
+model.model_vision.dataset_metas = [x.dataset.names for x in dataloader.tests]
+
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 12800
+
+train.output_dir = "output/" + __file__[:-3]
+
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/SegInW_InstanceSegmentation/ape_deta/ape_deta_vitl_eva02_lsj1024.py b/approach/ovod/APE/configs/SegInW_InstanceSegmentation/ape_deta/ape_deta_vitl_eva02_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..212471bc4962be8295cfa4ae78670cc4d68650f8
--- /dev/null
+++ b/approach/ovod/APE/configs/SegInW_InstanceSegmentation/ape_deta/ape_deta_vitl_eva02_lsj1024.py
@@ -0,0 +1,74 @@
+from detectron2.config import LazyCall as L
+from detectron2.solver import WarmupParamScheduler
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+from ape.data.detection_utils import get_fed_loss_cls_weights
+
+from ...common.data.seginw_instance_lsj1024 import dataloader
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+model.model_vision.criterion = [criterion for _ in range(25)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion,
+ [
+ 1000,
+ ]
+ * 25,
+):
+ criterion.num_classes = num_classes
+
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = -1.0
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+model.model_vision.neck = None
+
+train.max_iter = 720000
+train.eval_period = 720000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[640000],
+ num_updates=720000,
+ ),
+ warmup_length=1000 / 720000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+for i in range(len(dataloader.train)):
+ dataloader.train[i].total_batch_size = 16
+ dataloader.train[i].total_batch_size_list = [16]
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [x.dataset.names.replace("_val", "") for x in dataloader.tests]
+model.model_vision.dataset_metas = [x.dataset.names for x in dataloader.tests]
+
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 12800
+
+train.output_dir = "output/" + __file__[:-3]
+
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/SegInW_InstanceSegmentation/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024.py b/approach/ovod/APE/configs/SegInW_InstanceSegmentation/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..fb9ebce873f24f49012870fa5bfd1711769e83d9
--- /dev/null
+++ b/approach/ovod/APE/configs/SegInW_InstanceSegmentation/ape_deta/ape_deta_vitl_eva02_vlf_lsj1024.py
@@ -0,0 +1,109 @@
+from detectron2.config import LazyCall as L
+from detectron2.solver import WarmupParamScheduler
+from fvcore.common.param_scheduler import MultiStepParamScheduler
+from ape.data.detection_utils import get_fed_loss_cls_weights
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+
+from ...common.data.seginw_instance_lsj1024 import dataloader
+from ...LVIS_InstanceSegmentation.ape_deta.ape_deta_vitl_eva02_lsj1024_cp_24ep import (
+ model,
+ optimizer,
+ train,
+)
+
+model.model_vision.num_classes = 1256
+model.model_vision.select_box_nums_for_evaluation = 300
+
+criterion = model.model_vision.criterion[0]
+del criterion.use_fed_loss
+del criterion.get_fed_loss_cls_weights
+model.model_vision.criterion = [criterion for _ in range(25)]
+for criterion, num_classes in zip(
+ model.model_vision.criterion,
+ [
+ 1000,
+ ]
+ * 25,
+):
+ criterion.num_classes = num_classes
+
+
+model.model_vision.stuff_dataset_learn_thing = False
+model.model_vision.stuff_prob_thing = -1.0
+
+model.model_vision.instance_on = True
+model.model_vision.semantic_on = True
+model.model_vision.panoptic_on = False
+
+model.model_vision.neck = None
+
+train.max_iter = 720000
+train.eval_period = 720000
+
+lr_multiplier = L(WarmupParamScheduler)(
+ scheduler=L(MultiStepParamScheduler)(
+ values=[1.0, 0.1],
+ milestones=[640000],
+ num_updates=720000,
+ ),
+ warmup_length=1000 / 720000,
+ warmup_method="linear",
+ warmup_factor=0.001,
+)
+
+for i in range(len(dataloader.train)):
+ dataloader.train[i].total_batch_size = 16
+ dataloader.train[i].total_batch_size_list = [16]
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [x.dataset.names.replace("_val", "") for x in dataloader.tests]
+model.model_vision.dataset_metas = [x.dataset.names for x in dataloader.tests]
+
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ stable_softmax_2d=True,
+ clamp_min_for_underflow=True,
+ clamp_max_for_overflow=True,
+ use_checkpoint=True,
+)
+
+model.model_vision.text_feature_bank = True
+model.model_vision.text_feature_reduce_before_fusion = True
+model.model_vision.text_feature_batch_repeat = True
+model.model_vision.expression_cumulative_gt_class = True
+model.model_vision.name_prompt_fusion_type = "zero"
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 12800
+
+train.output_dir = "output/" + __file__[:-3]
+
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_12ep.py b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..cce2bfe18fe3b078358166a9417c743668c48b4f
--- /dev/null
+++ b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_12ep.py
@@ -0,0 +1,20 @@
+from ...COCO_InstanceSegmentation.ape_deta.ape_deta_r50_12ep import (
+ lr_multiplier,
+ model,
+ optimizer,
+ train,
+)
+from ...common.data.vgregion_instance import dataloader
+
+model.model_vision.num_classes = 200
+
+model.model_vision.criterion[0].num_classes = 200
+
+dataloader.train.mapper.max_num_phrase = 100
+
+model.model_vision.dataset_prompts = ["phrase", "expression"]
+model.model_vision.dataset_names = ["vgregion", "refcoco"]
+model.model_vision.dataset_metas = dataloader.train.dataset.names + ["refcoco-mixed"]
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 1280
diff --git a/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw13.py b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw13.py
new file mode 100644
index 0000000000000000000000000000000000000000..2bc51482401207da941dce8bb6054359b5a4f9f3
--- /dev/null
+++ b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw13.py
@@ -0,0 +1,10 @@
+from ...common.data.odinw13_instance import dataloader
+from .ape_deta_r50_12ep import lr_multiplier, model, optimizer, train
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [
+ test.dataset.names.replace("_val", "") for test in dataloader.tests
+]
+model.model_vision.dataset_metas = [test.dataset.names for test in dataloader.tests]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw35.py b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw35.py
new file mode 100644
index 0000000000000000000000000000000000000000..fb0a68150e8b3a322c09b9535ca4bd447302c93f
--- /dev/null
+++ b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_12ep_eval_odinw35.py
@@ -0,0 +1,10 @@
+from ...common.data.odinw35_instance import dataloader
+from .ape_deta_r50_12ep import lr_multiplier, model, optimizer, train
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [
+ test.dataset.names.replace("_val", "") for test in dataloader.tests
+]
+model.model_vision.dataset_metas = [test.dataset.names for test in dataloader.tests]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep.py b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep.py
new file mode 100644
index 0000000000000000000000000000000000000000..d0f6e6d337b8483f9c94eb30774fbe4993b27fc2
--- /dev/null
+++ b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep.py
@@ -0,0 +1,46 @@
+from detectron2.config import LazyCall as L
+from omegaconf import OmegaConf
+from ape.layers import VisionLanguageFusion
+from ape.modeling.ape_deta import (
+ DeformableDETRSegmVL,
+ DeformableDetrTransformerDecoderVL,
+ DeformableDetrTransformerEncoderVL,
+ DeformableDetrTransformerVL,
+)
+
+from .ape_deta_r50_12ep import dataloader, lr_multiplier, model, optimizer, train
+
+model.model_vision.update(
+ _target_=DeformableDETRSegmVL,
+)
+model.model_vision.transformer.update(
+ _target_=DeformableDetrTransformerVL,
+)
+model.model_vision.transformer.encoder.update(
+ _target_=DeformableDetrTransformerEncoderVL,
+)
+model.model_vision.transformer.decoder.update(
+ _target_=DeformableDetrTransformerDecoderVL,
+)
+
+
+model.model_vision.transformer.encoder.vl_layer = L(VisionLanguageFusion)(
+ v_dim="${....embed_dim}",
+ l_dim="${....embed_dim_language}",
+ embed_dim=2048,
+ num_heads=8,
+ dropout=0.1,
+ drop_path=0.0,
+ init_values=1.0 / 6,
+ cfg=OmegaConf.from_dotlist(
+ [
+ "MODEL.DYHEAD.FUSE_CONFIG.STABLE_SOFTMAX_2D=False",
+ "MODEL.DYHEAD.FUSE_CONFIG.CLAMP_MIN_FOR_UNDERFLOW=True",
+ "MODEL.DYHEAD.FUSE_CONFIG.CLAMP_MAX_FOR_OVERFLOW=True",
+ "MODEL.VL_FUSION_USE_CHECKPOINT=True",
+ ],
+ ),
+)
+
+train.output_dir = "output/" + __file__[:-3]
+model.model_vision.vis_period = 1280
diff --git a/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw13.py b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw13.py
new file mode 100644
index 0000000000000000000000000000000000000000..e017fae82e703156d858b0937ee3ae040620c634
--- /dev/null
+++ b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw13.py
@@ -0,0 +1,10 @@
+from ...common.data.odinw13_instance import dataloader
+from .ape_deta_r50_vlf_12ep import lr_multiplier, model, optimizer, train
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [
+ test.dataset.names.replace("_val", "") for test in dataloader.tests
+]
+model.model_vision.dataset_metas = [test.dataset.names for test in dataloader.tests]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw35.py b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw35.py
new file mode 100644
index 0000000000000000000000000000000000000000..e09309f978cbb10fdc0a2868c7eb7fb2c6045f72
--- /dev/null
+++ b/approach/ovod/APE/configs/VisualGenome_VisualGrounding/ape_deta/ape_deta_r50_vlf_12ep_eval_odinw35.py
@@ -0,0 +1,10 @@
+from ...common.data.odinw35_instance import dataloader
+from .ape_deta_r50_vlf_12ep import lr_multiplier, model, optimizer, train
+
+model.model_vision.dataset_prompts = ["name" for _ in dataloader.tests]
+model.model_vision.dataset_names = [
+ test.dataset.names.replace("_val", "") for test in dataloader.tests
+]
+model.model_vision.dataset_metas = [test.dataset.names for test in dataloader.tests]
+
+train.output_dir = "output/" + __file__[:-3]
diff --git a/approach/ovod/APE/configs/common/data/ade20k_panoptic.py b/approach/ovod/APE/configs/common/data/ade20k_panoptic.py
new file mode 100644
index 0000000000000000000000000000000000000000..f8211593b5c2a5145c6a031c9c34ad5f496cb212
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/ade20k_panoptic.py
@@ -0,0 +1,81 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOPanopticEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import DatasetMapper_detr_panoptic
+from ape.evaluation import InstanceSegEvaluator
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="ade20k_panoptic_train"),
+ mapper=L(DatasetMapper_detr_panoptic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(400, 500, 600),
+ sample_style="choice",
+ ),
+ L(T.RandomCrop)(
+ crop_type="absolute_range",
+ crop_size=(384, 600),
+ ),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("ade20k_panoptic_train").ignore_label,
+ stuff_classes_offset=0,
+ stuff_classes_decomposition=True,
+ dataset_names="${..dataset.names}",
+ ),
+ total_batch_size=16,
+ aspect_ratio_grouping=True,
+ num_workers=16,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="ade20k_panoptic_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = [
+ L(InstanceSegEvaluator)(
+ dataset_name="${...test.dataset.names}",
+ ),
+ L(SemSegEvaluator)(
+ dataset_name="${...test.dataset.names}",
+ ),
+ L(COCOPanopticEvaluator)(
+ dataset_name="${...test.dataset.names}",
+ ),
+]
diff --git a/approach/ovod/APE/configs/common/data/ade20k_panoptic_lsj1024.py b/approach/ovod/APE/configs/common/data/ade20k_panoptic_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..5f619a56289c5fe7427ecd378205b5c75195da08
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/ade20k_panoptic_lsj1024.py
@@ -0,0 +1,72 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOPanopticEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import DatasetMapper_detr_panoptic
+from ape.evaluation import InstanceSegEvaluator
+
+image_size = 1024
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="ade20k_panoptic_train"),
+ mapper=L(DatasetMapper_detr_panoptic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("ade20k_panoptic_train").ignore_label,
+ stuff_classes_offset=0,
+ stuff_classes_decomposition=True,
+ dataset_names="${..dataset.names}",
+ ),
+ total_batch_size=16,
+ num_workers=4,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="ade20k_panoptic_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = [
+ L(InstanceSegEvaluator)(
+ dataset_name="${...test.dataset.names}",
+ ),
+ L(SemSegEvaluator)(
+ dataset_name="${...test.dataset.names}",
+ ),
+ L(COCOPanopticEvaluator)(
+ dataset_name="${...test.dataset.names}",
+ ),
+]
diff --git a/approach/ovod/APE/configs/common/data/ade20k_semantic.py b/approach/ovod/APE/configs/common/data/ade20k_semantic.py
new file mode 100644
index 0000000000000000000000000000000000000000..8a9f713536bcd942d1dff30b073ff8f1feac3255
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/ade20k_semantic.py
@@ -0,0 +1,68 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import DatasetMapper_detr_semantic
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="ade20k_sem_seg_train"),
+ mapper=L(DatasetMapper_detr_semantic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(400, 500, 600),
+ sample_style="choice",
+ ),
+ L(T.RandomCrop)(
+ crop_type="absolute_range",
+ crop_size=(384, 600),
+ ),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ ignore_label=MetadataCatalog.get("ade20k_sem_seg_train").ignore_label,
+ stuff_classes_decomposition=True,
+ ),
+ total_batch_size=16,
+ num_workers=4,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="ade20k_sem_seg_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(SemSegEvaluator)(
+ dataset_name="${..test.dataset.names}",
+)
diff --git a/approach/ovod/APE/configs/common/data/ade20k_semantic_lsj1024.py b/approach/ovod/APE/configs/common/data/ade20k_semantic_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..2f7c45fc960b5792471878273e3b357a21290481
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/ade20k_semantic_lsj1024.py
@@ -0,0 +1,60 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import DatasetMapper_detr_semantic
+
+image_size = 1024
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="ade20k_sem_seg_train"),
+ mapper=L(DatasetMapper_detr_semantic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ ignore_label=MetadataCatalog.get("ade20k_sem_seg_train").ignore_label,
+ stuff_classes_decomposition=True,
+ ),
+ total_batch_size=16,
+ num_workers=4,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="ade20k_sem_seg_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(SemSegEvaluator)(
+ dataset_name="${..test.dataset.names}",
+)
diff --git a/approach/ovod/APE/configs/common/data/bdd10k_semantic_lsj1024.py b/approach/ovod/APE/configs/common/data/bdd10k_semantic_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..ab31a6ce9b6847f4a8bf57e06c78bf72f4d5a00f
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/bdd10k_semantic_lsj1024.py
@@ -0,0 +1,65 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import DatasetMapper_detr_panoptic
+
+image_size = 1024
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="bdd10k_val_sem_seg"),
+ mapper=L(DatasetMapper_detr_panoptic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("bdd10k_val_sem_seg").ignore_label,
+ stuff_classes_offset=0,
+ stuff_classes_decomposition=True,
+ dataset_names=["bdd10k_val_sem_seg"],
+ ),
+ total_batch_size=16,
+ num_workers=4,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="bdd10k_val_sem_seg", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = [
+ L(SemSegEvaluator)(
+ dataset_name="${...test.dataset.names}",
+ ),
+]
diff --git a/approach/ovod/APE/configs/common/data/coco_instance_lsj1024.py b/approach/ovod/APE/configs/common/data/coco_instance_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..15c257cdd84c07eeaa86d8654080d9a5bb01c3c1
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/coco_instance_lsj1024.py
@@ -0,0 +1,67 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_instance,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+from ape.evaluation import RefCOCOEvaluator
+
+image_size = 1024
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=("coco_2017_train",), filter_emptys=[True]
+ ),
+ mapper=L(DatasetMapper_detr_instance)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ num_workers=4,
+ num_datasets=1,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="coco_2017_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(COCOEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=100,
+)
diff --git a/approach/ovod/APE/configs/common/data/coco_refcoco_instance.py b/approach/ovod/APE/configs/common/data/coco_refcoco_instance.py
new file mode 100644
index 0000000000000000000000000000000000000000..c2850a53bc3eb141148da56367f23a97ddde755a
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/coco_refcoco_instance.py
@@ -0,0 +1,116 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_instance_exp,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+from ape.evaluation import RefCOCOEvaluator
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=(
+ "coco_2017_train",
+ "refcoco-mixed",
+ ),
+ filter_emptys=[True, True],
+ ),
+ mapper=L(DatasetMapper_detr_instance_exp)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(400, 500, 600),
+ sample_style="choice",
+ ),
+ L(T.RandomCrop)(
+ crop_type="absolute_range",
+ crop_size=(384, 600),
+ ),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ dataset_names=(
+ "coco_2017_train",
+ "refcoco-mixed",
+ ),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16],
+ num_workers=4,
+ num_datasets=2,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="coco_2017_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(COCOEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=100,
+)
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names
+]
+
+dataloader.evaluators = [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/coco_sa1b_instance.py b/approach/ovod/APE/configs/common/data/coco_sa1b_instance.py
new file mode 100644
index 0000000000000000000000000000000000000000..46b60ef11eb9d70670141e443b3c048d7901ccc6
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/coco_sa1b_instance.py
@@ -0,0 +1,96 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator, COCOPanopticEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=(
+ "coco_2017_train",
+ "sa1b_4m",
+ ),
+ filter_emptys=[True, False],
+ ),
+ mapper=L(DatasetMapper_detr_panoptic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(400, 500, 600),
+ sample_style="choice",
+ ),
+ L(T.RandomCrop)(
+ crop_type="absolute_range",
+ crop_size=(384, 600),
+ ),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("coco_2017_train_panoptic_stuffonly").ignore_label,
+ stuff_classes_offset=80,
+ dataset_names=["coco_2017_train", "sa1b"],
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=2,
+ dataset_ratio=[1, 1],
+ use_rfs=[False, False],
+ use_cas=[False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16],
+ num_workers=4,
+ num_datasets=2,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="coco_2017_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(COCOEvaluator)(
+ dataset_name="${..test.dataset.names}",
+)
diff --git a/approach/ovod/APE/configs/common/data/constants.py b/approach/ovod/APE/configs/common/data/constants.py
new file mode 100644
index 0000000000000000000000000000000000000000..3aaa07cfbdea56ca8bc8436db5f1209a4c86c179
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/constants.py
@@ -0,0 +1,4 @@
+constants = dict(
+ openai_imagenet_rgb256_mean=[122.7709383, 116.7460125, 104.09373615000001],
+ openai_imagenet_rgb256_std=[68.5005327, 66.6321579, 70.32316304999999],
+)
diff --git a/approach/ovod/APE/configs/common/data/d3_instance_lsj1024.py b/approach/ovod/APE/configs/common/data/d3_instance_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..239d3f40e15bf69da2b2a56b9fabc56e1a05286f
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/d3_instance_lsj1024.py
@@ -0,0 +1,100 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.data.catalog import DatasetCatalog
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_instance,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+from ape.evaluation import D3Evaluator
+
+image_size = 1024
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=("d3_inter_scenario",), filter_emptys=[True]
+ ),
+ mapper=L(DatasetMapper_detr_instance)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ num_workers=4,
+ num_datasets=1,
+)
+
+dataloader.tests = []
+dataloader.evaluators = []
+
+dataloader.tests.append(
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="d3_intra_scenario", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ )
+)
+
+dataloader.evaluators.append(
+ [
+ L(D3Evaluator)(dataset_name="d3_intra_scenario", max_dets_per_image=100, mode="FULL"),
+ L(D3Evaluator)(dataset_name="d3_intra_scenario", max_dets_per_image=100, mode="PRES"),
+ L(D3Evaluator)(dataset_name="d3_intra_scenario", max_dets_per_image=100, mode="ABS"),
+ ]
+)
+
+dataloader.tests.append(
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="d3_inter_scenario", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ )
+)
+
+dataloader.evaluators.append(
+ [
+ L(D3Evaluator)(dataset_name="d3_inter_scenario", max_dets_per_image=100, mode="FULL"),
+ L(D3Evaluator)(dataset_name="d3_inter_scenario", max_dets_per_image=100, mode="PRES"),
+ L(D3Evaluator)(dataset_name="d3_inter_scenario", max_dets_per_image=100, mode="ABS"),
+ ]
+)
+
+DatasetCatalog.get("d3_intra_scenario")
+DatasetCatalog.get("d3_inter_scenario")
diff --git a/approach/ovod/APE/configs/common/data/grit_instance_lsj224.py b/approach/ovod/APE/configs/common/data/grit_instance_lsj224.py
new file mode 100644
index 0000000000000000000000000000000000000000..7b248261827878c6f0a4094797c0dc0e892a0b6e
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/grit_instance_lsj224.py
@@ -0,0 +1,103 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_instance,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+from ape.evaluation import RefCOCOEvaluator
+
+image_size = 224
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=("grit",),
+ filter_emptys=[True],
+ ),
+ mapper=L(DatasetMapper_detr_instance)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ dataset_names=("grit",),
+ max_num_phrase=100,
+ nms_thresh_phrase=0.6,
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ num_workers=2,
+ num_datasets=1,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="refcoco-unc-val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(RefCOCOEvaluator)(
+ dataset_name="${..test.dataset.names}",
+)
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names[1:]
+]
+
+dataloader.evaluators = [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names[1:]
+]
diff --git a/approach/ovod/APE/configs/common/data/grit_sa1b_instance.py b/approach/ovod/APE/configs/common/data/grit_sa1b_instance.py
new file mode 100644
index 0000000000000000000000000000000000000000..2fdddb15f6de6b6a9e03c39b5899a2f95f6b4b90
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/grit_sa1b_instance.py
@@ -0,0 +1,130 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_instance,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+from ape.evaluation import RefCOCOEvaluator
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=("grit_16_snappy", "sa1b_4m"),
+ filter_emptys=[True, False],
+ ),
+ mapper=L(DatasetMapper_detr_instance)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(400, 500, 600),
+ sample_style="choice",
+ ),
+ L(T.RandomCrop)(
+ crop_type="absolute_range",
+ crop_size=(384, 600),
+ ),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ dataset_names=(
+ "grit",
+ "sa1b",
+ ),
+ max_num_phrase=100,
+ nms_thresh_phrase=0.6,
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=2,
+ dataset_ratio=[1, 1],
+ use_rfs=[True, True],
+ use_cas=[False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16],
+ num_workers=4,
+ num_datasets=2,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="refcoco-unc-val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(RefCOCOEvaluator)(
+ dataset_name="${..test.dataset.names}",
+)
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names[1:]
+]
+
+dataloader.evaluators = [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names[1:]
+]
diff --git a/approach/ovod/APE/configs/common/data/lvis_sa1b_instance.py b/approach/ovod/APE/configs/common/data/lvis_sa1b_instance.py
new file mode 100644
index 0000000000000000000000000000000000000000..9226d8ddf21e8410f3a9c4e7150bfc11f55ca28c
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lvis_sa1b_instance.py
@@ -0,0 +1,95 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import LVISEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_instance,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=("lvis_v1_train", "sa1b_4m"),
+ filter_emptys=[True, False],
+ ),
+ mapper=L(DatasetMapper_detr_instance)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(400, 500, 600),
+ sample_style="choice",
+ ),
+ L(T.RandomCrop)(
+ crop_type="absolute_range",
+ crop_size=(384, 600),
+ ),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ dataset_names=(
+ "lvis_v1_train",
+ "sa1b",
+ ),
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=2,
+ dataset_ratio=[1, 1],
+ use_rfs=[True, True],
+ use_cas=[False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16],
+ num_workers=8,
+ num_datasets=2,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
diff --git a/approach/ovod/APE/configs/common/data/lviscoco_cocostuff_panoptic_lsj1024_cp.py b/approach/ovod/APE/configs/common/data/lviscoco_cocostuff_panoptic_lsj1024_cp.py
new file mode 100644
index 0000000000000000000000000000000000000000..8c4953f716bb4cebfa92781e5849c93f7fe7e5d0
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lviscoco_cocostuff_panoptic_lsj1024_cp.py
@@ -0,0 +1,121 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.data.samplers import RepeatFactorTrainingSampler
+from detectron2.evaluation import LVISEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+
+dataloader = OmegaConf.create()
+
+image_size = 1024
+
+dataloader.train = L(build_detection_train_loader_multi_dataset_copypaste)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset_copypaste)(
+ names=["lvis_v1_train+coco", "coco_2017_train_panoptic_stuffonly"],
+ filter_emptys=[True, False],
+ copypastes=[True, False],
+ ),
+ dataset_bg=L(get_detection_dataset_dicts)(names=["lvis_v1_train+coco"]),
+ mapper=L(DatasetMapper_detr_panoptic_copypaste)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("coco_2017_train_panoptic_stuffonly").ignore_label,
+ stuff_classes_offset=0,
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names=["lvis_v1_train+coco", "coco_2017_train_panoptic_stuffonly"],
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=2,
+ dataset_ratio=[1, 1],
+ use_rfs=[True, False],
+ use_cas=[False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ sampler_bg=lambda dataset_dicts: RepeatFactorTrainingSampler(
+ repeat_factors=RepeatFactorTrainingSampler.repeat_factors_from_category_frequency(
+ dataset_dicts=dataset_dicts, repeat_thresh=0.001
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16],
+ aspect_ratio_grouping=True,
+ num_workers=4,
+ num_datasets=2,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="coco_2017_val_panoptic_stuffonly", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators = [
+ L(SemSegEvaluator)(
+ dataset_name="coco_2017_val_panoptic_stuffonly",
+ ),
+]
diff --git a/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vg_panoptic_lsj1024_cp.py b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vg_panoptic_lsj1024_cp.py
new file mode 100644
index 0000000000000000000000000000000000000000..1662d6852d21b4ca526816415ab9cf5ef14bb8a0
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vg_panoptic_lsj1024_cp.py
@@ -0,0 +1,235 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.data.samplers import RepeatFactorTrainingSampler
+from detectron2.evaluation import COCOEvaluator, LVISEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+from ape.evaluation.oideval import OIDEvaluator
+
+dataloader = OmegaConf.create()
+
+image_size = 1024
+
+dataloader.train = L(build_detection_train_loader_multi_dataset_copypaste)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset_copypaste)(
+ names=(
+ "lvis_v1_train+coco_panoptic_separated",
+ "objects365_train_fixname",
+ "openimages_v6_train_bbox_nogroup",
+ "visualgenome_150_box_train",
+ ),
+ filter_emptys=[True, True, True, True],
+ copypastes=[True, False, False, False],
+ ),
+ dataset_bg=L(get_detection_dataset_dicts)(names=["lvis_v1_train+coco_panoptic_separated"]),
+ mapper=L(DatasetMapper_detr_panoptic_copypaste)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("coco_2017_train_panoptic_stuffonly").ignore_label,
+ stuff_classes_offset=1203,
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names="${..dataset.names}",
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=4,
+ dataset_ratio=[1, 1, 1, 1],
+ use_rfs=[True, True, True, True],
+ use_cas=[False, False, False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ sampler_bg=lambda dataset_dicts: RepeatFactorTrainingSampler(
+ repeat_factors=RepeatFactorTrainingSampler.repeat_factors_from_category_frequency(
+ dataset_dicts=dataset_dicts, repeat_thresh=0.001
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16, 16, 16],
+ aspect_ratio_grouping=True,
+ num_workers=4,
+ num_datasets=4,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="coco_2017_val_panoptic_stuffonly", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators = [
+ L(SemSegEvaluator)(
+ dataset_name="coco_2017_val_panoptic_stuffonly",
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_minival", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+]
+
+dataloader.evaluators += [
+ L(LVISEvaluator)(
+ dataset_name="lvis_v1_minival",
+ max_dets_per_image=300,
+ )
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="objects365_minival_fixname", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="objects365_minival_fixname",
+ tasks=("bbox",),
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="objects365_val_fixname", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="objects365_val_fixname",
+ tasks=("bbox",),
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="openimages_v6_val_bbox", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(OIDEvaluator)(
+ dataset_name="openimages_v6_val_bbox",
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="visualgenome_150_box_val", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="visualgenome_150_box_val",
+ tasks=("bbox",),
+ ),
+]
diff --git a/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_refcoco_group_by_image_panoptic_lsj1024_cp.py b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_refcoco_group_by_image_panoptic_lsj1024_cp.py
new file mode 100644
index 0000000000000000000000000000000000000000..3fb7675c91e46577026c16350d0d7c4b30b9ddac
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_refcoco_group_by_image_panoptic_lsj1024_cp.py
@@ -0,0 +1,207 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.data.samplers import RepeatFactorTrainingSampler
+from detectron2.evaluation import COCOEvaluator, LVISEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+from ape.evaluation import RefCOCOEvaluator
+from ape.evaluation.oideval import OIDEvaluator
+
+dataloader = OmegaConf.create()
+
+image_size = 1024
+
+dataloader.train = L(build_detection_train_loader_multi_dataset_copypaste)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset_copypaste)(
+ names=(
+ "lvis_v1_train+coco_panoptic_separated",
+ "objects365_train_fixname",
+ "openimages_v6_train_bbox_nogroup",
+ "visualgenome_77962_box_and_region",
+ "refcoco-mixed_group-by-image",
+ ),
+ filter_emptys=[True, True, True, True, True],
+ copypastes=[True, False, False, False, False],
+ ),
+ dataset_bg=L(get_detection_dataset_dicts)(names=["lvis_v1_train+coco_panoptic_separated"]),
+ mapper=L(DatasetMapper_detr_panoptic_copypaste)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("coco_2017_train_panoptic_stuffonly").ignore_label,
+ stuff_classes_offset=1203,
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names="${..dataset.names}",
+ max_num_phrase=100,
+ nms_thresh_phrase=0.6,
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=5,
+ dataset_ratio=[1, 1, 1, 1, 0.1],
+ use_rfs=[True, True, True, False, False],
+ use_cas=[False, False, False, False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ sampler_bg=lambda dataset_dicts: RepeatFactorTrainingSampler(
+ repeat_factors=RepeatFactorTrainingSampler.repeat_factors_from_category_frequency(
+ dataset_dicts=dataset_dicts, repeat_thresh=0.001
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16, 16, 16, 16],
+ aspect_ratio_grouping=True,
+ num_workers=4,
+ num_datasets=5,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="coco_2017_val_panoptic_stuffonly", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators = [
+ L(SemSegEvaluator)(
+ dataset_name="coco_2017_val_panoptic_stuffonly",
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="objects365_val_fixname", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="objects365_val_fixname",
+ tasks=("bbox",),
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="openimages_v6_val_bbox", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(OIDEvaluator)(
+ dataset_name="openimages_v6_val_bbox",
+ ),
+]
+
+
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names
+]
+
+dataloader.evaluators += [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_refcoco_panoptic_lsj1024_cp.py b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_refcoco_panoptic_lsj1024_cp.py
new file mode 100644
index 0000000000000000000000000000000000000000..57e9524dbb277b5b7579c907cfde359cca1e6cc6
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_refcoco_panoptic_lsj1024_cp.py
@@ -0,0 +1,211 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.data.samplers import RepeatFactorTrainingSampler
+from detectron2.evaluation import COCOEvaluator, LVISEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+from ape.evaluation import RefCOCOEvaluator
+from ape.evaluation.oideval import OIDEvaluator
+
+dataloader = OmegaConf.create()
+
+image_size = 1024
+
+dataloader.train = L(build_detection_train_loader_multi_dataset_copypaste)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset_copypaste)(
+ names=(
+ "lvis_v1_train+coco_panoptic_separated",
+ "objects365_train_fixname",
+ "openimages_v6_train_bbox_nogroup",
+ "visualgenome_77962_box_and_region",
+ "refcoco-mixed",
+ ),
+ filter_emptys=[True, True, True, True, True],
+ copypastes=[True, False, False, False, False],
+ ),
+ dataset_bg=L(get_detection_dataset_dicts)(names=["lvis_v1_train+coco_panoptic_separated"]),
+ mapper=L(DatasetMapper_detr_panoptic_copypaste)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("coco_2017_train_panoptic_stuffonly").ignore_label,
+ stuff_classes_offset=1203,
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names=[
+ "lvis_v1_train+coco_panoptic_separated",
+ "objects365_train_fixname",
+ "openimages_v6_train_bbox_nogroup",
+ "visualgenome_77962_box_and_region",
+ "refcoco-mixed",
+ ],
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=5,
+ dataset_ratio=[1, 1, 1, 1, 1],
+ use_rfs=[True, True, True, False, False],
+ use_cas=[False, False, False, False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ sampler_bg=lambda dataset_dicts: RepeatFactorTrainingSampler(
+ repeat_factors=RepeatFactorTrainingSampler.repeat_factors_from_category_frequency(
+ dataset_dicts=dataset_dicts, repeat_thresh=0.001
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16, 16, 16, 16],
+ aspect_ratio_grouping=True,
+ num_workers=4,
+ num_datasets=5,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="coco_2017_val_panoptic_stuffonly", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators = [
+ L(SemSegEvaluator)(
+ dataset_name="coco_2017_val_panoptic_stuffonly",
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="objects365_val_fixname", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="objects365_val_fixname",
+ tasks=("bbox",),
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="openimages_v6_val_bbox", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(OIDEvaluator)(
+ dataset_name="openimages_v6_val_bbox",
+ ),
+]
+
+
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names
+]
+
+dataloader.evaluators += [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_panoptic_lsj1024_cp.py b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_panoptic_lsj1024_cp.py
new file mode 100644
index 0000000000000000000000000000000000000000..9246c05dc507575ef0bc76610ed5ca4acd4729cd
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_panoptic_lsj1024_cp.py
@@ -0,0 +1,217 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.data.samplers import RepeatFactorTrainingSampler
+from detectron2.evaluation import COCOEvaluator, LVISEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+from ape.evaluation import RefCOCOEvaluator
+from ape.evaluation.oideval import OIDEvaluator
+
+dataloader = OmegaConf.create()
+
+image_size = 1024
+
+dataloader.train = L(build_detection_train_loader_multi_dataset_copypaste)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset_copypaste)(
+ names=(
+ "lvis_v1_train+coco_panoptic_separated",
+ "objects365_train_fixname",
+ "openimages_v6_train_bbox_nogroup",
+ "visualgenome_77962_box_and_region",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa_region",
+ ),
+ filter_emptys=[True, True, True, True, False, True, True],
+ copypastes=[True, False, False, False, False, False, False],
+ ),
+ dataset_bg=L(get_detection_dataset_dicts)(names=["lvis_v1_train+coco_panoptic_separated"]),
+ mapper=L(DatasetMapper_detr_panoptic_copypaste)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("coco_2017_train_panoptic_stuffonly").ignore_label,
+ stuff_classes_offset=1203,
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names=[
+ "lvis_v1_train+coco_panoptic_separated",
+ "objects365_train_fixname",
+ "openimages_v6_train_bbox_nogroup",
+ "visualgenome_77962_box_and_region",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa_region",
+ ],
+ max_num_phrase=100,
+ nms_thresh_phrase=0.6,
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=7,
+ dataset_ratio=[1, 1, 1, 1, 1, 0.2, 0.1],
+ use_rfs=[True, True, True, False, False, False, False],
+ use_cas=[False, False, False, False, False, False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ sampler_bg=lambda dataset_dicts: RepeatFactorTrainingSampler(
+ repeat_factors=RepeatFactorTrainingSampler.repeat_factors_from_category_frequency(
+ dataset_dicts=dataset_dicts, repeat_thresh=0.001
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16, 16, 16, 16, 16, 16],
+ aspect_ratio_grouping=True,
+ num_workers=2,
+ num_datasets=7,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="coco_2017_val_panoptic_stuffonly", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators = [
+ L(SemSegEvaluator)(
+ dataset_name="coco_2017_val_panoptic_stuffonly",
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="objects365_val_fixname", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="objects365_val_fixname",
+ tasks=("bbox",),
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="openimages_v6_val_bbox", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(OIDEvaluator)(
+ dataset_name="openimages_v6_val_bbox",
+ ),
+]
+
+
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names
+]
+
+dataloader.evaluators += [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_panoptic_lsj1536_cp.py b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_panoptic_lsj1536_cp.py
new file mode 100644
index 0000000000000000000000000000000000000000..a2f5b66478c16145356743a5e2a052e2ccecce99
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_panoptic_lsj1536_cp.py
@@ -0,0 +1,217 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.data.samplers import RepeatFactorTrainingSampler
+from detectron2.evaluation import COCOEvaluator, LVISEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+from ape.evaluation import RefCOCOEvaluator
+from ape.evaluation.oideval import OIDEvaluator
+
+dataloader = OmegaConf.create()
+
+image_size = 1536
+
+dataloader.train = L(build_detection_train_loader_multi_dataset_copypaste)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset_copypaste)(
+ names=(
+ "lvis_v1_train+coco_panoptic_separated",
+ "objects365_train_fixname",
+ "openimages_v6_train_bbox_nogroup",
+ "visualgenome_77962_box_and_region",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa_region",
+ ),
+ filter_emptys=[True, True, True, True, False, True, True],
+ copypastes=[True, False, False, False, False, False, False],
+ ),
+ dataset_bg=L(get_detection_dataset_dicts)(names=["lvis_v1_train+coco_panoptic_separated"]),
+ mapper=L(DatasetMapper_detr_panoptic_copypaste)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("coco_2017_train_panoptic_stuffonly").ignore_label,
+ stuff_classes_offset=1203,
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names=[
+ "lvis_v1_train+coco_panoptic_separated",
+ "objects365_train_fixname",
+ "openimages_v6_train_bbox_nogroup",
+ "visualgenome_77962_box_and_region",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa_region",
+ ],
+ max_num_phrase=100,
+ nms_thresh_phrase=0.6,
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=7,
+ dataset_ratio=[1, 1, 1, 1, 1, 0.2, 0.1],
+ use_rfs=[True, True, True, False, False, False, False],
+ use_cas=[False, False, False, False, False, False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ sampler_bg=lambda dataset_dicts: RepeatFactorTrainingSampler(
+ repeat_factors=RepeatFactorTrainingSampler.repeat_factors_from_category_frequency(
+ dataset_dicts=dataset_dicts, repeat_thresh=0.001
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16, 16, 16, 16, 16, 16],
+ aspect_ratio_grouping=True,
+ num_workers=2,
+ num_datasets=7,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="coco_2017_val_panoptic_stuffonly", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators = [
+ L(SemSegEvaluator)(
+ dataset_name="coco_2017_val_panoptic_stuffonly",
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="objects365_val_fixname", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="objects365_val_fixname",
+ tasks=("bbox",),
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="openimages_v6_val_bbox", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(OIDEvaluator)(
+ dataset_name="openimages_v6_val_bbox",
+ ),
+]
+
+
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names
+]
+
+dataloader.evaluators += [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp.py b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp.py
new file mode 100644
index 0000000000000000000000000000000000000000..4703f0a1e5aea609a0b4ee8993748ebf30cd6689
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp.py
@@ -0,0 +1,257 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.data.samplers import RepeatFactorTrainingSampler
+from detectron2.evaluation import COCOEvaluator, LVISEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+from ape.evaluation import RefCOCOEvaluator
+from ape.evaluation.oideval import OIDEvaluator
+
+dataloader = OmegaConf.create()
+
+image_size = 1024
+
+dataloader.train = L(build_detection_train_loader_multi_dataset_copypaste)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset_copypaste)(
+ names=(
+ "lvis_v1_train+coco_panoptic_separated",
+ "objects365_train_fixname",
+ "openimages_v6_train_bbox_nogroup",
+ "visualgenome_77962_box_and_region",
+ "sa1b_6m",
+ "refcoco-mixed_group-by-image",
+ "gqa_region_train",
+ "phrasecut_train",
+ "flickr30k_separateGT_train",
+ ),
+ filter_emptys=[True, True, True, True, False, True, True, True, True],
+ copypastes=[True, False, False, False, False, False, False, False, False],
+ reduce_memory=True,
+ reduce_memory_size=1e6,
+ ),
+ dataset_bg=L(get_detection_dataset_dicts)(names=["lvis_v1_train+coco_panoptic_separated"]),
+ mapper=L(DatasetMapper_detr_panoptic_copypaste)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("coco_2017_train_panoptic_stuffonly").ignore_label,
+ stuff_classes_offset=1203,
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names="${..dataset.names}",
+ max_num_phrase=128,
+ nms_thresh_phrase=0.6,
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=9,
+ dataset_ratio=[1, 1, 1, 1, 1, 0.1, 0.1, 0.1, 0.1],
+ use_rfs=[True, True, True, False, False, False, False, False, False],
+ use_cas=[False, False, False, False, False, False, False, False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ sampler_bg=lambda dataset_dicts: RepeatFactorTrainingSampler(
+ repeat_factors=RepeatFactorTrainingSampler.repeat_factors_from_category_frequency(
+ dataset_dicts=dataset_dicts, repeat_thresh=0.001
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16, 16, 16, 16, 16, 16, 16, 16],
+ aspect_ratio_grouping=True,
+ num_workers=2,
+ num_datasets=9,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="coco_2017_val_panoptic_stuffonly", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators = [
+ L(SemSegEvaluator)(
+ dataset_name="coco_2017_val_panoptic_stuffonly",
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_minival", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+]
+
+dataloader.evaluators += [
+ L(LVISEvaluator)(
+ dataset_name="lvis_v1_minival",
+ max_dets_per_image=300,
+ )
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="objects365_minival_fixname", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="objects365_minival_fixname",
+ tasks=("bbox",),
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="objects365_val_fixname", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="objects365_val_fixname",
+ tasks=("bbox",),
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="openimages_v6_val_bbox", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(OIDEvaluator)(
+ dataset_name="openimages_v6_val_bbox",
+ ),
+]
+
+
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names
+]
+
+dataloader.evaluators += [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp_mdl.py b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp_mdl.py
new file mode 100644
index 0000000000000000000000000000000000000000..450c2ef67fb7a7af6d6d728bbf930abe57d83112
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1024_cp_mdl.py
@@ -0,0 +1,266 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.data.samplers import RepeatFactorTrainingSampler
+from detectron2.evaluation import COCOEvaluator, LVISEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic,
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+from ape.evaluation import RefCOCOEvaluator
+from ape.evaluation.oideval import OIDEvaluator
+
+dataloader = OmegaConf.create()
+
+image_size = 1024
+
+dataloader.train = [
+ L(build_detection_train_loader_multi_dataset_copypaste)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset_copypaste)(
+ names=(dataset_name,),
+ filter_emptys=[use_filter],
+ copypastes=[use_cp],
+ dataloader_id=dataloader_id,
+ reduce_memory=True,
+ reduce_memory_size=1e6,
+ ),
+ dataset_bg=L(get_detection_dataset_dicts)(
+ names=(dataset_name,),
+ filter_empty=use_filter,
+ )
+ if use_cp
+ else [[]],
+ mapper=L(DatasetMapper_detr_panoptic_copypaste)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get(dataset_name).get("ignore_label", None),
+ stuff_classes_offset=len(MetadataCatalog.get(dataset_name).get("thing_classes", [])),
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names=(dataset_name,),
+ max_num_phrase=128,
+ nms_thresh_phrase=0.6,
+ ),
+ sampler=L(RepeatFactorTrainingSampler)(
+ repeat_factors=L(RepeatFactorTrainingSampler.repeat_factors_from_category_frequency)(
+ dataset_dicts="${...dataset}", repeat_thresh=0.001
+ )
+ )
+ if use_rfs
+ else None,
+ sampler_bg=L(RepeatFactorTrainingSampler)(
+ repeat_factors=L(RepeatFactorTrainingSampler.repeat_factors_from_category_frequency)(
+ dataset_dicts="${...dataset}", repeat_thresh=0.001
+ )
+ )
+ if use_rfs and use_cp
+ else None,
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ aspect_ratio_grouping=True,
+ num_workers=2,
+ num_datasets=1,
+ )
+ for dataloader_id, use_rfs, use_cp, use_filter, dataset_name in [
+ [0, True, True, True, "lvis_v1_train+coco_panoptic_separated"],
+ [1, True, False, True, "objects365_train_fixname"],
+ [2, True, False, True, "openimages_v6_train_bbox_nogroup"],
+ [3, False, False, True, "visualgenome_77962_box_and_region"],
+ [4, False, False, False, "sa1b"],
+ [5, False, False, True, "refcoco-mixed_group-by-image"],
+ [6, False, False, True, "gqa_region_train"],
+ [7, False, False, True, "phrasecut_train"],
+ [8, False, False, True, "flickr30k_separateGT_train"],
+ ]
+]
+
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="coco_2017_val_panoptic_stuffonly", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators = [
+ L(SemSegEvaluator)(
+ dataset_name="coco_2017_val_panoptic_stuffonly",
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_minival", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ )
+]
+
+dataloader.evaluators += [
+ L(LVISEvaluator)(
+ dataset_name="lvis_v1_minival",
+ max_dets_per_image=300,
+ )
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="objects365_minival_fixname", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="objects365_minival_fixname",
+ tasks=("bbox",),
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="objects365_val_fixname", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="objects365_val_fixname",
+ tasks=("bbox",),
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="openimages_v6_val_bbox", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(OIDEvaluator)(
+ dataset_name="openimages_v6_val_bbox",
+ ),
+]
+
+
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names
+]
+
+dataloader.evaluators += [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1536_cp.py b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1536_cp.py
new file mode 100644
index 0000000000000000000000000000000000000000..68f5b770ba09c65dbb699f9f26694b10584a0498
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lviscocococostuff_o365_oid_vgr_sa1b_refcoco_group_by_image_gqa_phrasecut_flickr30k_panoptic_lsj1536_cp.py
@@ -0,0 +1,231 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.data.samplers import RepeatFactorTrainingSampler
+from detectron2.evaluation import COCOEvaluator, LVISEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+from ape.evaluation import RefCOCOEvaluator
+from ape.evaluation.oideval import OIDEvaluator
+
+dataloader = OmegaConf.create()
+
+image_size = 1536
+
+dataloader.train = L(build_detection_train_loader_multi_dataset_copypaste)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset_copypaste)(
+ names=(
+ "lvis_v1_train+coco_panoptic_separated",
+ "objects365_train_fixname",
+ "openimages_v6_train_bbox_nogroup",
+ "visualgenome_77962_box_and_region",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa_region_train",
+ "phrasecut_train",
+ "flickr30k_separateGT_train",
+ ),
+ filter_emptys=[True, True, True, True, False, True, True, True, True],
+ copypastes=[True, False, False, False, False, False, False, False, False],
+ ),
+ dataset_bg=L(get_detection_dataset_dicts)(names=["lvis_v1_train+coco_panoptic_separated"]),
+ mapper=L(DatasetMapper_detr_panoptic_copypaste)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("coco_2017_train_panoptic_stuffonly").ignore_label,
+ stuff_classes_offset=1203,
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names=[
+ "lvis_v1_train+coco_panoptic_separated",
+ "objects365_train_fixname",
+ "openimages_v6_train_bbox_nogroup",
+ "visualgenome_77962_box_and_region",
+ "sa1b",
+ "refcoco-mixed_group-by-image",
+ "gqa_region_train",
+ "phrasecut_train",
+ "flickr30k_separateGT_train",
+ ],
+ max_num_phrase=100,
+ nms_thresh_phrase=0.6,
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=9,
+ dataset_ratio=[1, 1, 1, 1, 1, 0.1, 0.1, 0.1, 0.1],
+ use_rfs=[True, True, True, False, False, False, False, False, False],
+ use_cas=[
+ False,
+ False,
+ False,
+ False,
+ False,
+ False,
+ False,
+ False,
+ False,
+ ],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ sampler_bg=lambda dataset_dicts: RepeatFactorTrainingSampler(
+ repeat_factors=RepeatFactorTrainingSampler.repeat_factors_from_category_frequency(
+ dataset_dicts=dataset_dicts, repeat_thresh=0.001
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16, 16, 16, 16, 16, 16, 16, 16],
+ aspect_ratio_grouping=True,
+ num_workers=2,
+ num_datasets=9,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="coco_2017_val_panoptic_stuffonly", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators = [
+ L(SemSegEvaluator)(
+ dataset_name="coco_2017_val_panoptic_stuffonly",
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="objects365_val_fixname", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(COCOEvaluator)(
+ dataset_name="objects365_val_fixname",
+ tasks=("bbox",),
+ ),
+]
+
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="openimages_v6_val_bbox", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators += [
+ L(OIDEvaluator)(
+ dataset_name="openimages_v6_val_bbox",
+ ),
+]
+
+
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names
+]
+
+dataloader.evaluators += [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/lviscocococostuff_refcoco_panoptic_lsj1024_cp.py b/approach/ovod/APE/configs/common/data/lviscocococostuff_refcoco_panoptic_lsj1024_cp.py
new file mode 100644
index 0000000000000000000000000000000000000000..28c9cf51b4ba708a01d92ec2ee36dbacb20983ad
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lviscocococostuff_refcoco_panoptic_lsj1024_cp.py
@@ -0,0 +1,155 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.data.samplers import RepeatFactorTrainingSampler
+from detectron2.evaluation import LVISEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+from ape.evaluation import RefCOCOEvaluator
+
+dataloader = OmegaConf.create()
+
+image_size = 1024
+
+dataloader.train = L(build_detection_train_loader_multi_dataset_copypaste)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset_copypaste)(
+ names=("lvis_v1_train+coco_panoptic_separated", "refcoco-mixed"),
+ filter_emptys=[True, True],
+ copypastes=[True, False],
+ ),
+ dataset_bg=L(get_detection_dataset_dicts)(names=["lvis_v1_train+coco_panoptic_separated"]),
+ mapper=L(DatasetMapper_detr_panoptic_copypaste)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("coco_2017_train_panoptic_stuffonly").ignore_label,
+ stuff_classes_offset=1203,
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names=["lvis_v1_train+coco_panoptic_separated", "refcoco-mixed"],
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=2,
+ dataset_ratio=[1, 1],
+ use_rfs=[True, False],
+ use_cas=[False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ sampler_bg=lambda dataset_dicts: RepeatFactorTrainingSampler(
+ repeat_factors=RepeatFactorTrainingSampler.repeat_factors_from_category_frequency(
+ dataset_dicts=dataset_dicts, repeat_thresh=0.001
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16],
+ aspect_ratio_grouping=True,
+ num_workers=4,
+ num_datasets=2,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="coco_2017_val_panoptic_stuffonly", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators = [
+ L(SemSegEvaluator)(
+ dataset_name="coco_2017_val_panoptic_stuffonly",
+ ),
+]
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests += [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names
+]
+
+dataloader.evaluators += [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/lviscocococostuff_sa1b_panoptic.py b/approach/ovod/APE/configs/common/data/lviscocococostuff_sa1b_panoptic.py
new file mode 100644
index 0000000000000000000000000000000000000000..74e254e7c1b2867b87206eb3db950308e1747a28
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/lviscocococostuff_sa1b_panoptic.py
@@ -0,0 +1,120 @@
+import random
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import LVISEvaluator, SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+from ape.data.samplers import MultiDatasetTrainingSampler
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=(
+ "lvis_v1_train+coco_panoptic_separated",
+ "sa1b_4m",
+ ),
+ filter_emptys=[True, False],
+ ),
+ mapper=L(DatasetMapper_detr_panoptic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(400, 500, 600),
+ sample_style="choice",
+ ),
+ L(T.RandomCrop)(
+ crop_type="absolute_range",
+ crop_size=(384, 600),
+ ),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get("coco_2017_train_panoptic_stuffonly").ignore_label,
+ stuff_classes_offset=1203,
+ stuff_classes_decomposition=True,
+ dataset_names=["lvis_v1_train+coco_panoptic_separated", "sa1b"],
+ ),
+ sampler=lambda dataset_dicts: MultiDatasetTrainingSampler(
+ repeat_factors=MultiDatasetTrainingSampler.get_repeat_factors(
+ dataset_dicts=dataset_dicts,
+ num_datasets=2,
+ dataset_ratio=[1, 1],
+ use_rfs=[True, True],
+ use_cas=[False, False],
+ repeat_thresh=0.001,
+ cas_lambda=1.0,
+ ),
+ seed=random.randint(0, 2**31),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16, 16],
+ num_workers=8,
+ num_datasets=2,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="lvis_v1_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(LVISEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ max_dets_per_image=300,
+)
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="coco_2017_val_panoptic_stuffonly", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ ),
+]
+
+dataloader.evaluators = [
+ L(SemSegEvaluator)(
+ dataset_name="coco_2017_val_panoptic_stuffonly",
+ ),
+]
diff --git a/approach/ovod/APE/configs/common/data/o365_instance_lsj1024.py b/approach/ovod/APE/configs/common/data/o365_instance_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..e792ea6933a399ab42d60f302780663b24fd191b
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/o365_instance_lsj1024.py
@@ -0,0 +1,66 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_instance,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+
+image_size = 1024
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=("objects365_train_fixname",), filter_emptys=[True]
+ ),
+ mapper=L(DatasetMapper_detr_instance)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ num_workers=4,
+ num_datasets=1,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="objects365_val_fixname", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(COCOEvaluator)(
+ dataset_name="${..test.dataset.names}",
+ tasks=("bbox",),
+)
diff --git a/approach/ovod/APE/configs/common/data/odinw13_instance.py b/approach/ovod/APE/configs/common/data/odinw13_instance.py
new file mode 100644
index 0000000000000000000000000000000000000000..36881a2547585414450f5b98c8f163ebde0b0ce1
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/odinw13_instance.py
@@ -0,0 +1,165 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic,
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+
+dataloader = OmegaConf.create()
+
+odinw_dataset_metas = [
+ "odinw_AerialMaritimeDrone_large_train",
+ "odinw_Aquarium_Aquarium_Combined.v2-raw-1024.coco_train",
+ "odinw_CottontailRabbits_train",
+ "odinw_EgoHands_generic_train",
+ "odinw_NorthAmericaMushrooms_North_American_Mushrooms.v1-416x416.coco_train",
+ "odinw_Packages_Raw_train",
+ "odinw_PascalVOC_train",
+ "odinw_pistols_export_train",
+ "odinw_pothole_train",
+ "odinw_Raccoon_Raccoon.v2-raw.coco_train",
+ "odinw_ShellfishOpenImages_raw_train",
+ "odinw_thermalDogsAndPeople_train",
+ "odinw_VehiclesOpenImages_416x416_train",
+]
+
+dataloader.train = [
+ L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=(dataset_name,),
+ filter_emptys=[True],
+ dataloader_id=dataloader_id,
+ reduce_memory=True,
+ reduce_memory_size=1e6,
+ ),
+ mapper=L(DatasetMapper_detr_panoptic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(400, 500, 600),
+ sample_style="choice",
+ ),
+ L(T.RandomCrop)(
+ crop_type="absolute_range",
+ crop_size=(384, 600),
+ ),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get(dataset_name).get("ignore_label", None),
+ stuff_classes_offset=len(MetadataCatalog.get(dataset_name).get("thing_classes", [])),
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names=(dataset_name,),
+ max_num_phrase=128,
+ nms_thresh_phrase=0.6,
+ ),
+ sampler=None,
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ aspect_ratio_grouping=True,
+ num_workers=16,
+ num_datasets=1,
+ )
+ for dataloader_id, dataset_name in enumerate(odinw_dataset_metas)
+]
+
+odinw_test_dataset_names = [
+ "odinw_AerialMaritimeDrone_large_test",
+ "odinw_Aquarium_Aquarium_Combined.v2-raw-1024.coco_test",
+ "odinw_CottontailRabbits_test",
+ "odinw_EgoHands_generic_test",
+ "odinw_NorthAmericaMushrooms_North_American_Mushrooms.v1-416x416.coco_test",
+ "odinw_Packages_Raw_test",
+ "odinw_PascalVOC_val",
+ "odinw_pistols_export_test",
+ "odinw_pothole_test",
+ "odinw_Raccoon_Raccoon.v2-raw.coco_test",
+ "odinw_ShellfishOpenImages_raw_test",
+ "odinw_thermalDogsAndPeople_test",
+ "odinw_VehiclesOpenImages_416x416_test",
+]
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ )
+ for name in odinw_test_dataset_names
+]
+
+dataloader.name_prompt_fusion_text = [
+ True,
+ True,
+ False,
+ False,
+ True,
+ True,
+ False,
+ False,
+ True,
+ True,
+ False,
+ True,
+ False,
+]
+
+dataloader.select_box_nums_for_evaluation_list = [
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+]
+
+dataloader.evaluators = [
+ L(COCOEvaluator)(
+ dataset_name=name,
+ tasks=("bbox",),
+ )
+ for name in odinw_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/odinw35_instance_lsj1024.py b/approach/ovod/APE/configs/common/data/odinw35_instance_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..390d7c77d833966fde4a78ed5559987dbd120eb8
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/odinw35_instance_lsj1024.py
@@ -0,0 +1,245 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic,
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+
+dataloader = OmegaConf.create()
+
+image_size = 1024
+
+odinw_dataset_metas = [
+ "odinw_AerialMaritimeDrone_large_train",
+ "odinw_AerialMaritimeDrone_tiled_train",
+ "odinw_AmericanSignLanguageLetters_American_Sign_Language_Letters.v1-v1.coco_train",
+ "odinw_Aquarium_Aquarium_Combined.v2-raw-1024.coco_train",
+ "odinw_BCCD_BCCD.v3-raw.coco_train",
+ "odinw_boggleBoards_416x416AutoOrient_export_train",
+ "odinw_brackishUnderwater_960x540_train",
+ "odinw_ChessPieces_Chess_Pieces.v23-raw.coco_train",
+ "odinw_CottontailRabbits_train",
+ "odinw_dice_mediumColor_export_train",
+ "odinw_DroneControl_Drone_Control.v3-raw.coco_train",
+ "odinw_EgoHands_generic_train",
+ "odinw_EgoHands_specific_train",
+ "odinw_HardHatWorkers_raw_train",
+ "odinw_MaskWearing_raw_train",
+ "odinw_MountainDewCommercial_train",
+ "odinw_NorthAmericaMushrooms_North_American_Mushrooms.v1-416x416.coco_train",
+ "odinw_openPoetryVision_512x512_train",
+ "odinw_OxfordPets_by-breed_train",
+ "odinw_OxfordPets_by-species_train",
+ "odinw_Packages_Raw_train",
+ "odinw_PascalVOC_train",
+ "odinw_pistols_export_train",
+ "odinw_PKLot_640_train",
+ "odinw_plantdoc_416x416_train",
+ "odinw_pothole_train",
+ "odinw_Raccoon_Raccoon.v2-raw.coco_train",
+ "odinw_selfdrivingCar_fixedLarge_export_train",
+ "odinw_ShellfishOpenImages_raw_train",
+ "odinw_ThermalCheetah_train",
+ "odinw_thermalDogsAndPeople_train",
+ "odinw_UnoCards_raw_train",
+ "odinw_VehiclesOpenImages_416x416_train",
+ "odinw_websiteScreenshots_train",
+ "odinw_WildfireSmoke_train",
+]
+
+dataloader.train = [
+ L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=(dataset_name,),
+ filter_emptys=[True],
+ dataloader_id=dataloader_id,
+ reduce_memory=True,
+ reduce_memory_size=1e6,
+ ),
+ mapper=L(DatasetMapper_detr_panoptic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get(dataset_name).get("ignore_label", None),
+ stuff_classes_offset=len(MetadataCatalog.get(dataset_name).get("thing_classes", [])),
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names=(dataset_name,),
+ max_num_phrase=128,
+ nms_thresh_phrase=0.6,
+ ),
+ sampler=None,
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ aspect_ratio_grouping=True,
+ num_workers=16,
+ num_datasets=1,
+ )
+ for dataloader_id, dataset_name in enumerate(odinw_dataset_metas)
+]
+
+odinw_test_dataset_names = [
+ "odinw_AerialMaritimeDrone_large_test",
+ "odinw_AerialMaritimeDrone_tiled_test",
+ "odinw_AmericanSignLanguageLetters_American_Sign_Language_Letters.v1-v1.coco_test",
+ "odinw_Aquarium_Aquarium_Combined.v2-raw-1024.coco_test",
+ "odinw_BCCD_BCCD.v3-raw.coco_test",
+ "odinw_boggleBoards_416x416AutoOrient_export_test",
+ "odinw_brackishUnderwater_960x540_test",
+ "odinw_ChessPieces_Chess_Pieces.v23-raw.coco_test",
+ "odinw_CottontailRabbits_test",
+ "odinw_dice_mediumColor_export_test",
+ "odinw_DroneControl_Drone_Control.v3-raw.coco_test",
+ "odinw_EgoHands_generic_test",
+ "odinw_EgoHands_specific_test",
+ "odinw_HardHatWorkers_raw_test",
+ "odinw_MaskWearing_raw_test",
+ "odinw_MountainDewCommercial_test",
+ "odinw_NorthAmericaMushrooms_North_American_Mushrooms.v1-416x416.coco_test",
+ "odinw_openPoetryVision_512x512_test",
+ "odinw_OxfordPets_by-breed_test",
+ "odinw_OxfordPets_by-species_test",
+ "odinw_Packages_Raw_test",
+ "odinw_PascalVOC_val",
+ "odinw_pistols_export_test",
+ "odinw_PKLot_640_test",
+ "odinw_plantdoc_416x416_test",
+ "odinw_pothole_test",
+ "odinw_Raccoon_Raccoon.v2-raw.coco_test",
+ "odinw_selfdrivingCar_fixedLarge_export_test",
+ "odinw_ShellfishOpenImages_raw_test",
+ "odinw_ThermalCheetah_test",
+ "odinw_thermalDogsAndPeople_test",
+ "odinw_UnoCards_raw_test",
+ "odinw_VehiclesOpenImages_416x416_test",
+ "odinw_websiteScreenshots_test",
+ "odinw_WildfireSmoke_test",
+]
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ )
+ for name in odinw_test_dataset_names
+]
+
+dataloader.name_prompt_fusion_text = [
+ True,
+ False,
+ True,
+ True,
+ True,
+ True,
+ True,
+ True,
+ False,
+ False,
+ True,
+ False,
+ False,
+ True,
+ True,
+ True,
+ True,
+ True,
+ True,
+ True,
+ True,
+ False,
+ False,
+ False,
+ True,
+ True,
+ True,
+ True,
+ False,
+ False,
+ True,
+ True,
+ False,
+ True,
+ True,
+]
+
+dataloader.select_box_nums_for_evaluation_list = [
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 1,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+]
+
+dataloader.evaluators = [
+ L(COCOEvaluator)(
+ dataset_name=name,
+ tasks=("bbox",),
+ )
+ for name in odinw_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/odinw35_instance_lsj1536.py b/approach/ovod/APE/configs/common/data/odinw35_instance_lsj1536.py
new file mode 100644
index 0000000000000000000000000000000000000000..9a604abf22fbbf5163b90b81b97854576764c587
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/odinw35_instance_lsj1536.py
@@ -0,0 +1,244 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic,
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+
+dataloader = OmegaConf.create()
+
+image_size = 1536
+
+odinw_dataset_metas = [
+ "odinw_AerialMaritimeDrone_large_train",
+ "odinw_AerialMaritimeDrone_tiled_train",
+ "odinw_AmericanSignLanguageLetters_American_Sign_Language_Letters.v1-v1.coco_train",
+ "odinw_Aquarium_Aquarium_Combined.v2-raw-1024.coco_train",
+ "odinw_BCCD_BCCD.v3-raw.coco_train",
+ "odinw_boggleBoards_416x416AutoOrient_export_train",
+ "odinw_brackishUnderwater_960x540_train",
+ "odinw_ChessPieces_Chess_Pieces.v23-raw.coco_train",
+ "odinw_CottontailRabbits_train",
+ "odinw_dice_mediumColor_export_train",
+ "odinw_DroneControl_Drone_Control.v3-raw.coco_train",
+ "odinw_EgoHands_generic_train",
+ "odinw_EgoHands_specific_train",
+ "odinw_HardHatWorkers_raw_train",
+ "odinw_MaskWearing_raw_train",
+ "odinw_MountainDewCommercial_train",
+ "odinw_NorthAmericaMushrooms_North_American_Mushrooms.v1-416x416.coco_train",
+ "odinw_openPoetryVision_512x512_train",
+ "odinw_OxfordPets_by-breed_train",
+ "odinw_OxfordPets_by-species_train",
+ "odinw_Packages_Raw_train",
+ "odinw_PascalVOC_train",
+ "odinw_pistols_export_train",
+ "odinw_PKLot_640_train",
+ "odinw_plantdoc_416x416_train",
+ "odinw_pothole_train",
+ "odinw_Raccoon_Raccoon.v2-raw.coco_train",
+ "odinw_selfdrivingCar_fixedLarge_export_train",
+ "odinw_ShellfishOpenImages_raw_train",
+ "odinw_ThermalCheetah_train",
+ "odinw_thermalDogsAndPeople_train",
+ "odinw_UnoCards_raw_train",
+ "odinw_VehiclesOpenImages_416x416_train",
+ "odinw_websiteScreenshots_train",
+ "odinw_WildfireSmoke_train",
+]
+
+dataloader.train = [
+ L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=(dataset_name,),
+ filter_emptys=[True],
+ dataloader_id=dataloader_id,
+ reduce_memory=True,
+ reduce_memory_size=1e6,
+ ),
+ mapper=L(DatasetMapper_detr_panoptic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get(dataset_name).get("ignore_label", None),
+ stuff_classes_offset=len(MetadataCatalog.get(dataset_name).get("thing_classes", [])),
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names=(dataset_name,),
+ max_num_phrase=128,
+ nms_thresh_phrase=0.6,
+ ),
+ sampler=None,
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ aspect_ratio_grouping=True,
+ num_workers=16,
+ num_datasets=1,
+ )
+ for dataloader_id, dataset_name in enumerate(odinw_dataset_metas)
+]
+
+odinw_test_dataset_names = [
+ "odinw_AerialMaritimeDrone_large_test",
+ "odinw_AerialMaritimeDrone_tiled_test",
+ "odinw_AmericanSignLanguageLetters_American_Sign_Language_Letters.v1-v1.coco_test",
+ "odinw_Aquarium_Aquarium_Combined.v2-raw-1024.coco_test",
+ "odinw_BCCD_BCCD.v3-raw.coco_test",
+ "odinw_boggleBoards_416x416AutoOrient_export_test",
+ "odinw_brackishUnderwater_960x540_test",
+ "odinw_ChessPieces_Chess_Pieces.v23-raw.coco_test",
+ "odinw_CottontailRabbits_test",
+ "odinw_dice_mediumColor_export_test",
+ "odinw_DroneControl_Drone_Control.v3-raw.coco_test",
+ "odinw_EgoHands_generic_test",
+ "odinw_EgoHands_specific_test",
+ "odinw_HardHatWorkers_raw_test",
+ "odinw_MaskWearing_raw_test",
+ "odinw_MountainDewCommercial_test",
+ "odinw_NorthAmericaMushrooms_North_American_Mushrooms.v1-416x416.coco_test",
+ "odinw_openPoetryVision_512x512_test",
+ "odinw_OxfordPets_by-breed_test",
+ "odinw_OxfordPets_by-species_test",
+ "odinw_Packages_Raw_test",
+ "odinw_PascalVOC_val",
+ "odinw_pistols_export_test",
+ "odinw_PKLot_640_test",
+ "odinw_plantdoc_416x416_test",
+ "odinw_pothole_test",
+ "odinw_Raccoon_Raccoon.v2-raw.coco_test",
+ "odinw_selfdrivingCar_fixedLarge_export_test",
+ "odinw_ShellfishOpenImages_raw_test",
+ "odinw_ThermalCheetah_test",
+ "odinw_thermalDogsAndPeople_test",
+ "odinw_UnoCards_raw_test",
+ "odinw_VehiclesOpenImages_416x416_test",
+ "odinw_websiteScreenshots_test",
+ "odinw_WildfireSmoke_test",
+]
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ )
+ for name in odinw_test_dataset_names
+]
+
+dataloader.name_prompt_fusion_text = [
+ True,
+ False,
+ True,
+ True,
+ True,
+ True,
+ True,
+ True,
+ False,
+ False,
+ True,
+ False,
+ False,
+ True,
+ True,
+ True,
+ True,
+ True,
+ True,
+ True,
+ True,
+ False,
+ False,
+ False,
+ True,
+ True,
+ True,
+ True,
+ False,
+ False,
+ True,
+ True,
+ False,
+ True,
+ True,
+]
+
+dataloader.select_box_nums_for_evaluation_list = [
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 1,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+ 300,
+]
+
+dataloader.evaluators = [
+ L(COCOEvaluator)(
+ dataset_name=name,
+ tasks=("bbox",),
+ )
+ for name in odinw_test_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/pascalcontext59_semantic_lsj1024.py b/approach/ovod/APE/configs/common/data/pascalcontext59_semantic_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..66bc6435d59ba5e0df7d81a8504a4cefe2766732
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/pascalcontext59_semantic_lsj1024.py
@@ -0,0 +1,62 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import DatasetMapper_detr_semantic
+
+image_size = 1024
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="pascal_context_59_sem_seg_val"),
+ mapper=L(DatasetMapper_detr_semantic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ ignore_label=MetadataCatalog.get("pascal_context_59_sem_seg_val").ignore_label,
+ stuff_classes_decomposition=True,
+ ),
+ total_batch_size=16,
+ num_workers=4,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(
+ names="pascal_context_59_sem_seg_val", filter_empty=False
+ ),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(SemSegEvaluator)(
+ dataset_name="${..test.dataset.names}",
+)
diff --git a/approach/ovod/APE/configs/common/data/pascalvoc20_semantic_lsj1024.py b/approach/ovod/APE/configs/common/data/pascalvoc20_semantic_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..f8119aeaf2c27f6379a9e70f8eed4c2c45fdc1b3
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/pascalvoc20_semantic_lsj1024.py
@@ -0,0 +1,60 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import SemSegEvaluator
+from omegaconf import OmegaConf
+from ape.data import DatasetMapper_detr_semantic
+
+image_size = 1024
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="pascalvoc20_sem_seg_val"),
+ mapper=L(DatasetMapper_detr_semantic)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ ignore_label=MetadataCatalog.get("pascalvoc20_sem_seg_val").ignore_label,
+ stuff_classes_decomposition=True,
+ ),
+ total_batch_size=16,
+ num_workers=4,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="pascalvoc20_sem_seg_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(SemSegEvaluator)(
+ dataset_name="${..test.dataset.names}",
+)
diff --git a/approach/ovod/APE/configs/common/data/phrasecut_instance_lsj1024.py b/approach/ovod/APE/configs/common/data/phrasecut_instance_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..6e07dcb64a766f480e29b9384c4d98a66254851c
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/phrasecut_instance_lsj1024.py
@@ -0,0 +1,70 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_instance,
+ DatasetMapper_detr_instance_exp,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+from ape.evaluation import RefCOCOEvaluator
+
+dataloader = OmegaConf.create()
+
+image_size = 1024
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=("phrasecut_train",), filter_emptys=[True]
+ ),
+ mapper=L(DatasetMapper_detr_instance_exp)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ dataset_names=("phrasecut_train",),
+ max_num_phrase=256,
+ nms_thresh_phrase=0.6,
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ num_workers=4,
+ num_datasets=1,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="phrasecut_val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(RefCOCOEvaluator)(
+ dataset_name="${..test.dataset.names}",
+)
diff --git a/approach/ovod/APE/configs/common/data/refcoco_group_by_image_instance_lsj1024.py b/approach/ovod/APE/configs/common/data/refcoco_group_by_image_instance_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..94b532b291ab4467491e91044d7018d05032e970
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/refcoco_group_by_image_instance_lsj1024.py
@@ -0,0 +1,102 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_instance,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+from ape.evaluation import RefCOCOEvaluator
+
+image_size = 1024
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=("refcoco-mixed_group-by-image",), filter_emptys=[True]
+ ),
+ mapper=L(DatasetMapper_detr_instance)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=1.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(horizontal=True), # flip first
+ L(T.ResizeScale)(
+ min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size
+ ),
+ L(T.FixedSizeCrop)(crop_size=(image_size, image_size), pad=False),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ dataset_names=("refcoco-mixed_group-by-image",),
+ max_num_phrase=128,
+ nms_thresh_phrase=0.6,
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ num_workers=4,
+ num_datasets=1,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="refcoco-unc-val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(RefCOCOEvaluator)(
+ dataset_name="${..test.dataset.names}",
+)
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=image_size, max_size=image_size),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names[1:]
+]
+
+dataloader.evaluators = [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names[1:]
+]
diff --git a/approach/ovod/APE/configs/common/data/refcoco_instance.py b/approach/ovod/APE/configs/common/data/refcoco_instance.py
new file mode 100644
index 0000000000000000000000000000000000000000..924940f438844cb892ae6255b43b1322d00510c8
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/refcoco_instance.py
@@ -0,0 +1,107 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ build_detection_test_loader,
+ build_detection_train_loader,
+ get_detection_dataset_dicts,
+)
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_instance_exp,
+ build_detection_train_loader_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset,
+)
+from ape.evaluation import RefCOCOEvaluator
+
+dataloader = OmegaConf.create()
+
+dataloader.train = L(build_detection_train_loader_multi_dataset)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset)(
+ names=("refcoco-mixed",), filter_emptys=[True]
+ ),
+ mapper=L(DatasetMapper_detr_instance_exp)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(400, 500, 600),
+ sample_style="choice",
+ ),
+ L(T.RandomCrop)(
+ crop_type="absolute_range",
+ crop_size=(384, 600),
+ ),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ dataset_names=("refcoco-mixed",),
+ ),
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ num_workers=16,
+ num_datasets=1,
+)
+
+dataloader.test = L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="refcoco-unc-val", filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${...train.mapper.image_format}",
+ ),
+ num_workers=4,
+)
+
+dataloader.evaluator = L(RefCOCOEvaluator)(
+ dataset_name="${..test.dataset.names}",
+)
+
+refcoco_test_dataset_names = [
+ "refcoco-unc-val",
+ "refcoco-unc-testA",
+ "refcoco-unc-testB",
+ "refcocoplus-unc-val",
+ "refcocoplus-unc-testA",
+ "refcocoplus-unc-testB",
+ "refcocog-google-val",
+ "refcocog-umd-val",
+ "refcocog-umd-test",
+]
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="${....train.mapper.image_format}",
+ ),
+ num_workers=4,
+ )
+ for name in refcoco_test_dataset_names[1:]
+]
+
+dataloader.evaluators = [
+ L(RefCOCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in refcoco_test_dataset_names[1:]
+]
diff --git a/approach/ovod/APE/configs/common/data/roboflow100_instance_lsj1024.py b/approach/ovod/APE/configs/common/data/roboflow100_instance_lsj1024.py
new file mode 100644
index 0000000000000000000000000000000000000000..b7367088743c8df14147a090a4fc99f88a1db2ac
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/roboflow100_instance_lsj1024.py
@@ -0,0 +1,76 @@
+import json
+import os
+
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import DatasetMapper, build_detection_test_loader, get_detection_dataset_dicts
+from detectron2.data.datasets.register_coco import register_coco_instances
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+
+dataloader = OmegaConf.create()
+
+data_root = "datasets/rf100"
+
+rf100_dataset_names = []
+for root, dirs, files in os.walk(data_root):
+ for d in dirs:
+ if root == data_root:
+ pass
+ else:
+ continue
+
+ rf100_dataset_names.append(d)
+
+ d = os.path.join(root, d)
+ print(len(rf100_dataset_names), d)
+print(rf100_dataset_names, len(rf100_dataset_names))
+assert len(rf100_dataset_names) == 100
+
+
+def _get_builtin_metadata(name):
+ meta = {}
+ json_file = os.path.join(data_root, name, "valid", "_annotations.coco.json")
+ with open(json_file, "r") as fr:
+ json_data = json.load(fr)
+ meta["thing_classes"] = [category["name"] for category in json_data["categories"]]
+
+ return meta
+
+
+for key in rf100_dataset_names:
+ print("register_coco_instances", key)
+ register_coco_instances(
+ "rf100_" + key,
+ _get_builtin_metadata(key),
+ os.path.join(data_root, key, "valid", "_annotations.coco.json"),
+ os.path.join(data_root, key, "valid"),
+ )
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names="rf100_" + name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=1024, max_size=1024),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ )
+ for name in rf100_dataset_names
+]
+
+dataloader.name_prompt_fusion_text = [True] * len(rf100_dataset_names)
+
+
+dataloader.select_box_nums_for_evaluation_list = [300] * len(rf100_dataset_names)
+
+dataloader.evaluators = [
+ L(COCOEvaluator)(
+ dataset_name="rf100_" + name,
+ tasks=("bbox",),
+ )
+ for name in rf100_dataset_names
+]
diff --git a/approach/ovod/APE/configs/common/data/seginw_instance.py b/approach/ovod/APE/configs/common/data/seginw_instance.py
new file mode 100644
index 0000000000000000000000000000000000000000..741efe7769d804841e1bd6897e86febfb5476a7f
--- /dev/null
+++ b/approach/ovod/APE/configs/common/data/seginw_instance.py
@@ -0,0 +1,162 @@
+import detectron2.data.transforms as T
+from detectron2.config import LazyCall as L
+from detectron2.data import (
+ DatasetMapper,
+ MetadataCatalog,
+ build_detection_test_loader,
+ get_detection_dataset_dicts,
+)
+from detectron2.evaluation import COCOEvaluator
+from omegaconf import OmegaConf
+from ape.data import (
+ DatasetMapper_detr_panoptic,
+ DatasetMapper_detr_panoptic_copypaste,
+ build_detection_train_loader_multi_dataset,
+ build_detection_train_loader_multi_dataset_copypaste,
+ get_detection_dataset_dicts_multi_dataset,
+ get_detection_dataset_dicts_multi_dataset_copypaste,
+)
+
+dataloader = OmegaConf.create()
+
+seginw_dataset_metas = [
+ "seginw_Elephants_train",
+ "seginw_Hand-Metal_train",
+ "seginw_Watermelon_train",
+ "seginw_House-Parts_train",
+ "seginw_HouseHold-Items_train",
+ "seginw_Strawberry_train",
+ "seginw_Fruits_train",
+ "seginw_Nutterfly-Squireel_train",
+ "seginw_Hand_train",
+ "seginw_Garbage_train",
+ "seginw_Chicken_train",
+ "seginw_Rail_train",
+ "seginw_Airplane-Parts_train",
+ "seginw_Brain-Tumor_train",
+ "seginw_Poles_train",
+ "seginw_Electric-Shaver_train",
+ "seginw_Bottles_train",
+ "seginw_Toolkits_train",
+ "seginw_Trash_train",
+ "seginw_Salmon-Fillet_train",
+ "seginw_Puppies_train",
+ "seginw_Tablets_train",
+ "seginw_Phones_train",
+ "seginw_Cows_train",
+ "seginw_Ginger-Garlic_train",
+]
+
+dataloader.train = [
+ L(build_detection_train_loader_multi_dataset_copypaste)(
+ dataset=L(get_detection_dataset_dicts_multi_dataset_copypaste)(
+ names=(dataset_name,),
+ filter_emptys=[True],
+ copypastes=[True],
+ dataloader_id=dataloader_id,
+ reduce_memory=True,
+ reduce_memory_size=1e6,
+ ),
+ dataset_bg=L(get_detection_dataset_dicts)(
+ names=(dataset_name,),
+ filter_empty=True,
+ ),
+ mapper=L(DatasetMapper_detr_panoptic_copypaste)(
+ is_train=True,
+ augmentations=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ augmentations_with_crop=[
+ L(T.RandomFlip)(),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(400, 500, 600),
+ sample_style="choice",
+ ),
+ L(T.RandomCrop)(
+ crop_type="absolute_range",
+ crop_size=(384, 600),
+ ),
+ L(T.ResizeShortestEdge)(
+ short_edge_length=(480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800),
+ max_size=1333,
+ sample_style="choice",
+ ),
+ ],
+ image_format="RGB",
+ use_instance_mask=True,
+ recompute_boxes=True,
+ instance_mask_format="bitmask",
+ ignore_label=MetadataCatalog.get(dataset_name).get("ignore_label", None),
+ stuff_classes_offset=len(MetadataCatalog.get(dataset_name).get("thing_classes", [])),
+ stuff_classes_decomposition=True,
+ output_dir=None,
+ vis_period=12800,
+ dataset_names=(dataset_name,),
+ max_num_phrase=128,
+ nms_thresh_phrase=0.6,
+ ),
+ sampler=None,
+ sampler_bg=None,
+ total_batch_size=16,
+ total_batch_size_list=[16],
+ aspect_ratio_grouping=True,
+ num_workers=16,
+ num_datasets=1,
+ )
+ for dataloader_id, dataset_name in enumerate(seginw_dataset_metas)
+]
+
+seginw_test_dataset_names = [
+ "seginw_Elephants_val",
+ "seginw_Hand-Metal_val",
+ "seginw_Watermelon_val",
+ "seginw_House-Parts_val",
+ "seginw_HouseHold-Items_val",
+ "seginw_Strawberry_val",
+ "seginw_Fruits_val",
+ "seginw_Nutterfly-Squireel_val",
+ "seginw_Hand_val",
+ "seginw_Garbage_val",
+ "seginw_Chicken_val",
+ "seginw_Rail_val",
+ "seginw_Airplane-Parts_val",
+ "seginw_Brain-Tumor_val",
+ "seginw_Poles_val",
+ "seginw_Electric-Shaver_val",
+ "seginw_Bottles_val",
+ "seginw_Toolkits_val",
+ "seginw_Trash_val",
+ "seginw_Salmon-Fillet_val",
+ "seginw_Puppies_val",
+ "seginw_Tablets_val",
+ "seginw_Phones_val",
+ "seginw_Cows_val",
+ "seginw_Ginger-Garlic_val",
+]
+
+dataloader.tests = [
+ L(build_detection_test_loader)(
+ dataset=L(get_detection_dataset_dicts)(names=name, filter_empty=False),
+ mapper=L(DatasetMapper)(
+ is_train=False,
+ augmentations=[
+ L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333),
+ ],
+ image_format="RGB",
+ ),
+ num_workers=4,
+ )
+ for name in seginw_test_dataset_names
+]
+
+dataloader.evaluators = [
+ L(COCOEvaluator)(
+ dataset_name=name,
+ )
+ for name in seginw_test_dataset_names
+]
diff --git a/approach/ovod/APE/inference_on_image.sh b/approach/ovod/APE/inference_on_image.sh
new file mode 100644
index 0000000000000000000000000000000000000000..7f527d454f566ebbd38538fc551a296d46acecba
--- /dev/null
+++ b/approach/ovod/APE/inference_on_image.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+python demo/demo_lazy.py \
+--config-file configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k.py \
+--input demo/examples/Pisa.jpg \
+--output ./test_output \
+--confidence-threshold 0.1 \
+--text-prompt 'sky' \
+--with-box \
+--opts \
+train.init_checkpoint='./ape_d_model_final.pth' \
+model.model_language.cache_dir='' \
+model.model_vision.select_box_nums_for_evaluation=500 \
+model.model_vision.text_feature_bank_reset=True \
+model.model_vision.backbone.net.xattn=False \
+model.model_vision.transformer.encoder.pytorch_attn=True \
+model.model_vision.transformer.decoder.pytorch_attn=True
\ No newline at end of file
diff --git a/approach/ovod/APE/requirements.txt b/approach/ovod/APE/requirements.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7221c7870b15e16e4793dcb9117e49cef69e0d47
--- /dev/null
+++ b/approach/ovod/APE/requirements.txt
@@ -0,0 +1,14 @@
+torch
+torchvision
+transformers
+cython
+opencv-python
+scipy
+einops
+lvis
+fairscale
+xformers
+apex
+git+https://github.com/facebookresearch/detectron2@017abbf
+git+https://github.com/IDEA-Research/detrex@776058e
+git+https://github.com/openai/CLIP.git@d50d76d
diff --git a/approach/ovod/APE/setup.py b/approach/ovod/APE/setup.py
new file mode 100644
index 0000000000000000000000000000000000000000..e227b36fd2d82d8764927a849f53b4c6e55af68e
--- /dev/null
+++ b/approach/ovod/APE/setup.py
@@ -0,0 +1,162 @@
+#!/usr/bin/env python
+# Copyright (c) Facebook, Inc. and its affiliates.
+
+import glob
+import os
+import shutil
+from os import path
+from typing import List
+
+import torch
+from setuptools import find_packages, setup
+from torch.utils.cpp_extension import CUDA_HOME, CppExtension, CUDAExtension
+
+torch_ver = [int(x) for x in torch.__version__.split(".")[:2]]
+assert torch_ver >= [1, 8], "Requires PyTorch >= 1.8"
+
+
+def get_version():
+ init_py_path = path.join(path.abspath(path.dirname(__file__)), "ape", "__init__.py")
+ init_py = open(init_py_path, "r").readlines()
+ version_line = [l.strip() for l in init_py if l.startswith("__version__")][0]
+ version = version_line.split("=")[-1].strip().strip("'\"")
+
+ # The following is used to build release packages.
+ # Users should never use it.
+ suffix = os.getenv("D2_VERSION_SUFFIX", "")
+ version = version + suffix
+ if os.getenv("BUILD_NIGHTLY", "0") == "1":
+ from datetime import datetime
+
+ date_str = datetime.today().strftime("%y%m%d")
+ version = version + ".dev" + date_str
+
+ new_init_py = [l for l in init_py if not l.startswith("__version__")]
+ new_init_py.append('__version__ = "{}"\n'.format(version))
+ with open(init_py_path, "w") as f:
+ f.write("".join(new_init_py))
+ return version
+
+
+def get_extensions():
+ this_dir = path.dirname(path.abspath(__file__))
+ extensions_dir = path.join(this_dir, "ape", "layers", "csrc")
+
+ main_source = path.join(extensions_dir, "vision.cpp")
+ sources = glob.glob(path.join(extensions_dir, "**", "*.cpp"))
+
+ from torch.utils.cpp_extension import ROCM_HOME
+
+ is_rocm_pytorch = (
+ True if ((torch.version.hip is not None) and (ROCM_HOME is not None)) else False
+ )
+ if is_rocm_pytorch:
+ assert torch_ver >= [1, 8], "ROCM support requires PyTorch >= 1.8!"
+
+ # common code between cuda and rocm platforms, for hipify version [1,0,0] and later.
+ source_cuda = glob.glob(path.join(extensions_dir, "**", "*.cu")) + glob.glob(
+ path.join(extensions_dir, "*.cu")
+ )
+ sources = [main_source] + sources
+
+ extension = CppExtension
+
+ extra_compile_args = {"cxx": []}
+ define_macros = []
+
+ if (torch.cuda.is_available() and ((CUDA_HOME is not None) or is_rocm_pytorch)) or os.getenv(
+ "FORCE_CUDA", "0"
+ ) == "1":
+ extension = CUDAExtension
+ sources += source_cuda
+
+ if not is_rocm_pytorch:
+ define_macros += [("WITH_CUDA", None)]
+ extra_compile_args["nvcc"] = [
+ "-O3",
+ "-DCUDA_HAS_FP16=1",
+ "-D__CUDA_NO_HALF_OPERATORS__",
+ "-D__CUDA_NO_HALF_CONVERSIONS__",
+ "-D__CUDA_NO_HALF2_OPERATORS__",
+ ]
+ else:
+ define_macros += [("WITH_HIP", None)]
+ extra_compile_args["nvcc"] = []
+
+ nvcc_flags_env = os.getenv("NVCC_FLAGS", "")
+ if nvcc_flags_env != "":
+ extra_compile_args["nvcc"].extend(nvcc_flags_env.split(" "))
+
+ if torch_ver < [1, 7]:
+ # supported by https://github.com/pytorch/pytorch/pull/43931
+ CC = os.environ.get("CC", None)
+ if CC is not None:
+ extra_compile_args["nvcc"].append("-ccbin={}".format(CC))
+
+ include_dirs = [extensions_dir]
+
+ ext_modules = [
+ extension(
+ "ape._C",
+ sources,
+ include_dirs=include_dirs,
+ define_macros=define_macros,
+ extra_compile_args=extra_compile_args,
+ )
+ ]
+
+ return ext_modules
+
+
+def get_model_zoo_configs() -> List[str]:
+ """
+ Return a list of configs to include in package for model zoo. Copy over these configs inside
+ detectron2/model_zoo.
+ """
+
+ # Use absolute paths while symlinking.
+ source_configs_dir = path.join(path.dirname(path.realpath(__file__)), "configs")
+ destination = path.join(path.dirname(path.realpath(__file__)), "ape", "model_zoo", "configs")
+ # Symlink the config directory inside package to have a cleaner pip install.
+
+ # Remove stale symlink/directory from a previous build.
+ if path.exists(source_configs_dir):
+ if path.islink(destination):
+ os.unlink(destination)
+ elif path.isdir(destination):
+ shutil.rmtree(destination)
+
+ if not path.exists(destination):
+ try:
+ os.symlink(source_configs_dir, destination)
+ except OSError:
+ # Fall back to copying if symlink fails: ex. on Windows.
+ shutil.copytree(source_configs_dir, destination)
+
+ config_paths = glob.glob("configs/**/*.yaml", recursive=True) + glob.glob(
+ "configs/**/*.py", recursive=True
+ )
+ return config_paths
+
+
+# For projects that are relative small and provide features that are very close
+# to detectron2's core functionalities, we install them under detectron2.projects
+PROJECTS = {
+}
+
+setup(
+ name="ape",
+ version=get_version(),
+ author="Yunhang Shen",
+ url="https://github.com/shenyunhang",
+ description="APE is next-generation research "
+ "framework for object detection and segmentation.",
+ packages=find_packages(exclude=("configs", "tests*")) + list(PROJECTS.keys()),
+ package_dir=PROJECTS,
+ package_data={"ape.model_zoo": get_model_zoo_configs(), "ape.modeling.text.eva02_clip": ["*.gz", "**/*.json"], "ape.modeling.text.eva01_clip": ["*.gz", "**/*.json"]},
+ python_requires=">=3.7",
+ install_requires=[
+ ],
+ ext_modules=get_extensions(),
+ cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension},
+)
diff --git a/approach/ovod/d-cube/LICENSE b/approach/ovod/d-cube/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..67846aa0c4d75d272acbec5d9f4fc91fdfe05bc4
--- /dev/null
+++ b/approach/ovod/d-cube/LICENSE
@@ -0,0 +1,352 @@
+Creative Commons Attribution-NonCommercial 4.0 International
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright and
+certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+- Considerations for licensors: Our public licenses are intended for
+ use by those authorized to give the public permission to use
+ material in ways otherwise restricted by copyright and certain other
+ rights. Our licenses are irrevocable. Licensors should read and
+ understand the terms and conditions of the license they choose
+ before applying it. Licensors should also secure all rights
+ necessary before applying our licenses so that the public can reuse
+ the material as expected. Licensors should clearly mark any material
+ not subject to the license. This includes other CC-licensed
+ material, or material used under an exception or limitation to
+ copyright. More considerations for licensors :
+ wiki.creativecommons.org/Considerations_for_licensors
+
+- Considerations for the public: By using one of our public licenses,
+ a licensor grants the public permission to use the licensed material
+ under specified terms and conditions. If the licensor's permission
+ is not necessary for any reason–for example, because of any
+ applicable exception or limitation to copyright–then that use is not
+ regulated by the license. Our licenses grant only permissions under
+ copyright and certain other rights that a licensor has authority to
+ grant. Use of the licensed material may still be restricted for
+ other reasons, including because others have copyright or other
+ rights in the material. A licensor may make special requests, such
+ as asking that all changes be marked or described. Although not
+ required by our licenses, you are encouraged to respect those
+ requests where reasonable. More considerations for the public :
+ wiki.creativecommons.org/Considerations_for_licensees
+
+Creative Commons Attribution-NonCommercial 4.0 International Public
+License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution-NonCommercial 4.0 International Public License ("Public
+License"). To the extent this Public License may be interpreted as a
+contract, You are granted the Licensed Rights in consideration of Your
+acceptance of these terms and conditions, and the Licensor grants You
+such rights in consideration of benefits the Licensor receives from
+making the Licensed Material available under these terms and conditions.
+
+- Section 1 – Definitions.
+
+ - a. Adapted Material means material subject to Copyright and
+ Similar Rights that is derived from or based upon the Licensed
+ Material and in which the Licensed Material is translated,
+ altered, arranged, transformed, or otherwise modified in a
+ manner requiring permission under the Copyright and Similar
+ Rights held by the Licensor. For purposes of this Public
+ License, where the Licensed Material is a musical work,
+ performance, or sound recording, Adapted Material is always
+ produced where the Licensed Material is synched in timed
+ relation with a moving image.
+ - b. Adapter's License means the license You apply to Your
+ Copyright and Similar Rights in Your contributions to Adapted
+ Material in accordance with the terms and conditions of this
+ Public License.
+ - c. Copyright and Similar Rights means copyright and/or similar
+ rights closely related to copyright including, without
+ limitation, performance, broadcast, sound recording, and Sui
+ Generis Database Rights, without regard to how the rights are
+ labeled or categorized. For purposes of this Public License, the
+ rights specified in Section 2(b)(1)-(2) are not Copyright and
+ Similar Rights.
+ - d. Effective Technological Measures means those measures that,
+ in the absence of proper authority, may not be circumvented
+ under laws fulfilling obligations under Article 11 of the WIPO
+ Copyright Treaty adopted on December 20, 1996, and/or similar
+ international agreements.
+ - e. Exceptions and Limitations means fair use, fair dealing,
+ and/or any other exception or limitation to Copyright and
+ Similar Rights that applies to Your use of the Licensed
+ Material.
+ - f. Licensed Material means the artistic or literary work,
+ database, or other material to which the Licensor applied this
+ Public License.
+ - g. Licensed Rights means the rights granted to You subject to
+ the terms and conditions of this Public License, which are
+ limited to all Copyright and Similar Rights that apply to Your
+ use of the Licensed Material and that the Licensor has authority
+ to license.
+ - h. Licensor means the individual(s) or entity(ies) granting
+ rights under this Public License.
+ - i. NonCommercial means not primarily intended for or directed
+ towards commercial advantage or monetary compensation. For
+ purposes of this Public License, the exchange of the Licensed
+ Material for other material subject to Copyright and Similar
+ Rights by digital file-sharing or similar means is NonCommercial
+ provided there is no payment of monetary compensation in
+ connection with the exchange.
+ - j. Share means to provide material to the public by any means or
+ process that requires permission under the Licensed Rights, such
+ as reproduction, public display, public performance,
+ distribution, dissemination, communication, or importation, and
+ to make material available to the public including in ways that
+ members of the public may access the material from a place and
+ at a time individually chosen by them.
+ - k. Sui Generis Database Rights means rights other than copyright
+ resulting from Directive 96/9/EC of the European Parliament and
+ of the Council of 11 March 1996 on the legal protection of
+ databases, as amended and/or succeeded, as well as other
+ essentially equivalent rights anywhere in the world.
+ - l. You means the individual or entity exercising the Licensed
+ Rights under this Public License. Your has a corresponding
+ meaning.
+
+- Section 2 – Scope.
+
+ - a. License grant.
+ - 1. Subject to the terms and conditions of this Public
+ License, the Licensor hereby grants You a worldwide,
+ royalty-free, non-sublicensable, non-exclusive, irrevocable
+ license to exercise the Licensed Rights in the Licensed
+ Material to:
+ - A. reproduce and Share the Licensed Material, in whole
+ or in part, for NonCommercial purposes only; and
+ - B. produce, reproduce, and Share Adapted Material for
+ NonCommercial purposes only.
+ - 2. Exceptions and Limitations. For the avoidance of doubt,
+ where Exceptions and Limitations apply to Your use, this
+ Public License does not apply, and You do not need to comply
+ with its terms and conditions.
+ - 3. Term. The term of this Public License is specified in
+ Section 6(a).
+ - 4. Media and formats; technical modifications allowed. The
+ Licensor authorizes You to exercise the Licensed Rights in
+ all media and formats whether now known or hereafter
+ created, and to make technical modifications necessary to do
+ so. The Licensor waives and/or agrees not to assert any
+ right or authority to forbid You from making technical
+ modifications necessary to exercise the Licensed Rights,
+ including technical modifications necessary to circumvent
+ Effective Technological Measures. For purposes of this
+ Public License, simply making modifications authorized by
+ this Section 2(a)(4) never produces Adapted Material.
+ - 5. Downstream recipients.
+ - A. Offer from the Licensor – Licensed Material. Every
+ recipient of the Licensed Material automatically
+ receives an offer from the Licensor to exercise the
+ Licensed Rights under the terms and conditions of this
+ Public License.
+ - B. No downstream restrictions. You may not offer or
+ impose any additional or different terms or conditions
+ on, or apply any Effective Technological Measures to,
+ the Licensed Material if doing so restricts exercise of
+ the Licensed Rights by any recipient of the Licensed
+ Material.
+ - 6. No endorsement. Nothing in this Public License
+ constitutes or may be construed as permission to assert or
+ imply that You are, or that Your use of the Licensed
+ Material is, connected with, or sponsored, endorsed, or
+ granted official status by, the Licensor or others
+ designated to receive attribution as provided in Section
+ 3(a)(1)(A)(i).
+ - b. Other rights.
+ - 1. Moral rights, such as the right of integrity, are not
+ licensed under this Public License, nor are publicity,
+ privacy, and/or other similar personality rights; however,
+ to the extent possible, the Licensor waives and/or agrees
+ not to assert any such rights held by the Licensor to the
+ limited extent necessary to allow You to exercise the
+ Licensed Rights, but not otherwise.
+ - 2. Patent and trademark rights are not licensed under this
+ Public License.
+ - 3. To the extent possible, the Licensor waives any right to
+ collect royalties from You for the exercise of the Licensed
+ Rights, whether directly or through a collecting society
+ under any voluntary or waivable statutory or compulsory
+ licensing scheme. In all other cases the Licensor expressly
+ reserves any right to collect such royalties, including when
+ the Licensed Material is used other than for NonCommercial
+ purposes.
+
+- Section 3 – License Conditions.
+
+ Your exercise of the Licensed Rights is expressly made subject to
+ the following conditions.
+
+ - a. Attribution.
+ - 1. If You Share the Licensed Material (including in modified
+ form), You must:
+ - A. retain the following if it is supplied by the
+ Licensor with the Licensed Material:
+ - i. identification of the creator(s) of the Licensed
+ Material and any others designated to receive
+ attribution, in any reasonable manner requested by
+ the Licensor (including by pseudonym if designated);
+ - ii. a copyright notice;
+ - iii. a notice that refers to this Public License;
+ - iv. a notice that refers to the disclaimer of
+ warranties;
+ - v. a URI or hyperlink to the Licensed Material to
+ the extent reasonably practicable;
+ - B. indicate if You modified the Licensed Material and
+ retain an indication of any previous modifications; and
+ - C. indicate the Licensed Material is licensed under this
+ Public License, and include the text of, or the URI or
+ hyperlink to, this Public License.
+ - 2. You may satisfy the conditions in Section 3(a)(1) in any
+ reasonable manner based on the medium, means, and context in
+ which You Share the Licensed Material. For example, it may
+ be reasonable to satisfy the conditions by providing a URI
+ or hyperlink to a resource that includes the required
+ information.
+ - 3. If requested by the Licensor, You must remove any of the
+ information required by Section 3(a)(1)(A) to the extent
+ reasonably practicable.
+ - 4. If You Share Adapted Material You produce, the Adapter's
+ License You apply must not prevent recipients of the Adapted
+ Material from complying with this Public License.
+
+- Section 4 – Sui Generis Database Rights.
+
+ Where the Licensed Rights include Sui Generis Database Rights that
+ apply to Your use of the Licensed Material:
+
+ - a. for the avoidance of doubt, Section 2(a)(1) grants You the
+ right to extract, reuse, reproduce, and Share all or a
+ substantial portion of the contents of the database for
+ NonCommercial purposes only;
+ - b. if You include all or a substantial portion of the database
+ contents in a database in which You have Sui Generis Database
+ Rights, then the database in which You have Sui Generis Database
+ Rights (but not its individual contents) is Adapted Material;
+ and
+ - c. You must comply with the conditions in Section 3(a) if You
+ Share all or a substantial portion of the contents of the
+ database.
+
+ For the avoidance of doubt, this Section 4 supplements and does not
+ replace Your obligations under this Public License where the
+ Licensed Rights include other Copyright and Similar Rights.
+
+- Section 5 – Disclaimer of Warranties and Limitation of Liability.
+
+ - a. Unless otherwise separately undertaken by the Licensor, to
+ the extent possible, the Licensor offers the Licensed Material
+ as-is and as-available, and makes no representations or
+ warranties of any kind concerning the Licensed Material, whether
+ express, implied, statutory, or other. This includes, without
+ limitation, warranties of title, merchantability, fitness for a
+ particular purpose, non-infringement, absence of latent or other
+ defects, accuracy, or the presence or absence of errors, whether
+ or not known or discoverable. Where disclaimers of warranties
+ are not allowed in full or in part, this disclaimer may not
+ apply to You.
+ - b. To the extent possible, in no event will the Licensor be
+ liable to You on any legal theory (including, without
+ limitation, negligence) or otherwise for any direct, special,
+ indirect, incidental, consequential, punitive, exemplary, or
+ other losses, costs, expenses, or damages arising out of this
+ Public License or use of the Licensed Material, even if the
+ Licensor has been advised of the possibility of such losses,
+ costs, expenses, or damages. Where a limitation of liability is
+ not allowed in full or in part, this limitation may not apply to
+ You.
+ - c. The disclaimer of warranties and limitation of liability
+ provided above shall be interpreted in a manner that, to the
+ extent possible, most closely approximates an absolute
+ disclaimer and waiver of all liability.
+
+- Section 6 – Term and Termination.
+
+ - a. This Public License applies for the term of the Copyright and
+ Similar Rights licensed here. However, if You fail to comply
+ with this Public License, then Your rights under this Public
+ License terminate automatically.
+ - b. Where Your right to use the Licensed Material has terminated
+ under Section 6(a), it reinstates:
+
+ - 1. automatically as of the date the violation is cured,
+ provided it is cured within 30 days of Your discovery of the
+ violation; or
+ - 2. upon express reinstatement by the Licensor.
+
+ For the avoidance of doubt, this Section 6(b) does not affect
+ any right the Licensor may have to seek remedies for Your
+ violations of this Public License.
+
+ - c. For the avoidance of doubt, the Licensor may also offer the
+ Licensed Material under separate terms or conditions or stop
+ distributing the Licensed Material at any time; however, doing
+ so will not terminate this Public License.
+ - d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+ License.
+
+- Section 7 – Other Terms and Conditions.
+
+ - a. The Licensor shall not be bound by any additional or
+ different terms or conditions communicated by You unless
+ expressly agreed.
+ - b. Any arrangements, understandings, or agreements regarding the
+ Licensed Material not stated herein are separate from and
+ independent of the terms and conditions of this Public License.
+
+- Section 8 – Interpretation.
+
+ - a. For the avoidance of doubt, this Public License does not, and
+ shall not be interpreted to, reduce, limit, restrict, or impose
+ conditions on any use of the Licensed Material that could
+ lawfully be made without permission under this Public License.
+ - b. To the extent possible, if any provision of this Public
+ License is deemed unenforceable, it shall be automatically
+ reformed to the minimum extent necessary to make it enforceable.
+ If the provision cannot be reformed, it shall be severed from
+ this Public License without affecting the enforceability of the
+ remaining terms and conditions.
+ - c. No term or condition of this Public License will be waived
+ and no failure to comply consented to unless expressly agreed to
+ by the Licensor.
+ - d. Nothing in this Public License constitutes or may be
+ interpreted as a limitation upon, or waiver of, any privileges
+ and immunities that apply to the Licensor or You, including from
+ the legal processes of any jurisdiction or authority.
+
+Creative Commons is not a party to its public licenses. Notwithstanding,
+Creative Commons may elect to apply one of its public licenses to
+material it publishes and in those instances will be considered the
+"Licensor." The text of the Creative Commons public licenses is
+dedicated to the public domain under the CC0 Public Domain Dedication.
+Except for the limited purpose of indicating that material is shared
+under a Creative Commons public license or as otherwise permitted by the
+Creative Commons policies published at creativecommons.org/policies,
+Creative Commons does not authorize the use of the trademark "Creative
+Commons" or any other trademark or logo of Creative Commons without its
+prior written consent including, without limitation, in connection with
+any unauthorized modifications to any of its public licenses or any
+other arrangements, understandings, or agreements concerning use of
+licensed material. For the avoidance of doubt, this paragraph does not
+form part of the public licenses.
+
+Creative Commons may be contacted at creativecommons.org.
diff --git a/approach/ovod/d-cube/doc.md b/approach/ovod/d-cube/doc.md
new file mode 100644
index 0000000000000000000000000000000000000000..bcee034f1c995c62b4b90c25e873a2463fb6415b
--- /dev/null
+++ b/approach/ovod/d-cube/doc.md
@@ -0,0 +1,275 @@
+# $D^3$ Toolkit Documentation
+
+
+## Table of Contents
+
+- [Inference](#inference-on-d3)
+- [Key Concepts](#key-concepts-for-users)
+- [Evaluation Settings](#evaluation-settings)
+- [Evaluation Code and Examples](#evaluation-code-and-examples)
+- [Dataset statistics](#dataset-statistics)
+
+
+
+
+## Inference on $D^3$
+
+```python
+# import the dataset class
+from d_cube import D3
+# init a dataset instance
+d3 = D3(IMG_ROOT, PKL_ANNO_PATH)
+all_img_ids = d3.get_img_ids() # get the image ids in the dataset
+all_img_info = d3.load_imgs(all_img_ids) # load images by passing a list containing some image ids
+img_path = all_img_info[0]["file_name"] # obtain one image path so you can load it and inference
+# then you can load the image as input for your model
+
+group_ids = d3.get_group_ids(img_ids=[img_id]) # get the group ids by passing anno ids, image ids, etc.
+sent_ids = d3.get_sent_ids(group_ids=group_ids) # get the sentence ids by passing image ids, group ids, etc.
+sent_list = d3.load_sents(sent_ids=sent_ids)
+ref_list = [sent['raw_sent'] for sent in sent_list] # list[str]
+# use these language references in `ref_list` as the references to your REC/OVD/DOD model
+
+# save the result to a JSON file
+```
+
+Concepts and structures of `anno`, `image`, `sent` and `group` are explained in [this part](#key-concepts-for-users).
+
+In [this directory](eval_sota/) we provide the inference (and evaluation) script on some existing SOTA OVD/REC methods.
+
+
+
+### Output Format
+When the inference is done, you need to save a JSON file in the format below (COCO standard output JSON form):
+```json
+[
+ {
+ "category_id": "int, the value of sent_id, range [1, 422]",
+ "bbox": "list[int], [x1, y1, w, h], predicted by your model, same as COCO result format, absolute value in the range of [w, h, w, h]",
+ "image_id": "int, img_id, can be 0, 1, 2, ....",
+ "score": "float, predicted by your model, no restriction on its absolute value range"
+ }
+]
+```
+This JSON file should contain a list, where each item in the list is a dictionary of one detection result.
+
+With this JSON saved, you can evaluate the JSON in the next step. See [the evaluation step](#evaluation-code-and-examples).
+
+
+
+
+
+## Key Concepts for Users
+
+### `anno`
+A Python dictionary where the keys are integers and the values are dictionaries with the following key-value pairs:
+
+* `id`: an integer representing the ID of the annotation.
+* `sent_id`: a list of integers representing the IDs of sentences associated with this annotation.
+* `segmentation`: a Run Length Encoding (RLE) representation of the annotation.
+* `area`: an integer representing the area of the annotation.
+* `iscrowd`: an integer indicating whether this annotation represents a crowd or not.
+* `image_id`: an integer representing the ID of the image associated with this annotation.
+* `bbox`: a list of four integers representing the bounding box coordinates of the annotation in the format [x, y, width, height].
+* `group_id`: a value that can be any object and represents the ID of the group associated with this annotation.
+
+``` python
+{
+ 1 : {
+ "id": int,
+ "sent_id": list,
+ "segmentation": RLE,
+ "area": int,
+ "iscrowd": int,
+ "image_id": int,
+ "bbox": list, # [x, y, width, height]
+ "group_id": int
+ }
+}
+```
+
+### `image`
+A Python dictionary where the keys are integers and the values are dictionaries with the following key-value pairs:
+
+* `id`: an integer representing the ID of the image.
+* `file_name`: a string representing the file name of the image.
+* `height`: an integer representing the height of the image.
+* `width`: an integer representing the width of the image.
+* `flickr_url`: a string representing the Flickr URL of the image.
+* `anno_id`: a list of integers representing the IDs of annotations associated with this image.
+* `group_id`: an integer representing the ID of the group associated with this image.
+* `license`: a string representing the license of the image.
+
+``` python
+{
+ int : {
+ "id": int,
+ "file_name": str,
+ "height": int,
+ "width": int,
+ "flickr_url": str,
+ "anno_id": list,
+ "group_id": int,
+ "license": str,
+ }
+}
+```
+
+### `sent`
+A Python dictionary where the keys are integers and the values are dictionaries with the following key-value pairs:
+
+* `id`: an integer representing the ID of the sentence.
+* `anno_id`: a list of integers representing the IDs of annotations associated with this sentence.
+* `group_id`: a list of integers representing the IDs of groups associated with this sentence.
+* `is_negative`: a boolean indicating whether this sentence is *absence expression* or not. `True` means *absence expression*.
+* `raw_sent`: a string representing the raw text of the sentence in English.
+* `raw_sent_zh`: a string representing the raw text of the sentence in Chinese.
+
+``` python
+{
+ int : {
+ "id": int,
+ "anno_id": list,
+ "group_id": list,
+ "is_negative": bool,
+ "raw_sent": str,
+ "raw_sent_zh": str
+ }
+}
+```
+
+### `group`
+A Python dictionary where the keys are integers and the values are dictionaries with the following key-value pairs:
+
+* `id`: an integer representing the ID of the group.
+* `pos_sent_id`: a list of integers representing the IDs of sentences that has referred obejct in the group.
+* `inner_sent_id`: a list of integers representing the IDs of sentences belonging to this group.
+* `outer_sent_id`: a list of integers representing the IDs of outer-group sentences that has referred obejct in the group.
+* `img_id`: a list of integers representing the IDs of images of this group.
+* `scene`: a list of strings representing the scenes of this group.
+* `group_name`: a string representing the name of this group in English.
+* `group_name_zh`: a string representing the name of this group in Chinese.
+
+``` python
+{
+ int : {
+ "id": int,
+ "pos_sent_id": list,
+ "inner_sent_id": list,
+ "outer_sent_id": list,
+ "img_id": list,
+ "scene": list,
+ "group_name": str,
+ "group_name_zh": str
+ }
+}
+```
+
+
+
+
+
+## Evaluation Settings
+
+
+### Intra- or Inter-Group Settings
+
+The default evaluation protocol is the intra-group setting, where only a certain references are evaluated for each image.
+
+In the $D^3$ dataset, images are collected for different groups (scenarios), and the categories (descriptions) are designed based on the scenarios. For the intra-group setting, each image are only evaluated with the descriptions from the group the image belongs to. We call this **intra-scenario setting**.
+
+Note that each category is actually annotated on each image (with positive or negative instances).
+So you can also evaluate all categories on all images, just like traditional detection datasets. We call this **inter-scenario setting**.
+This is quite challenging for the DOD task as this will produce many false positive instances on current methods.
+
+For intra-group evaluation, you should use:
+```
+sent_ids = d3.get_sent_ids(group_ids=group_ids)
+# only get the refs (sents) for the group the image belongs to, which is usually 4
+```
+
+For inter-group evaluation, change the correponding code to:
+
+```
+sent_ids = d3.get_sent_ids()
+# get all the refs in the dataset
+```
+
+This will use all the sentences in the dataset, rather than a few sentences in the group that this image belongs to.
+
+This is the only difference in the implentation and evaluation. No further code changes need to be applied.
+
+For more information, you can refer to the Section 3.4 of the DOD paper.
+
+
+### FULL, PRES and ABS
+
+FULL, PRES and ABS means the full descriptions (422 categories), presence descriptions (316 categories) and absence descriptions (106 categories).
+
+The meaning of absence descriptions are the descriptions involving the absence of some concepts, like lacking certain relationships, attributes or objects. For example, descriptions like "dog *without* leash", "person *without* helmet" and "a hat that is *not* blue" are absence ones.
+Similary, the descriptions involving *only* the presence of some concepts are presence descriptions.
+
+Most existing REC datasets have presence descriptions but few absence descriptions.
+
+For more details and the meaning of evaluating absence descriptions, please refer to Section 3.1 of the DOD paper.
+
+
+
+
+## Evaluation Code and Examples
+
+In this part, we introduce how to evaluate the performance and get the metric values given the prediction result of a JSON file.
+
+### Write a Snippet in Your Code
+
+This is based on [cocoapi (pycocotools)](https://github.com/cocodataset/cocoapi/tree/master/PythonAPI), and is quite simple:
+
+```python
+from pycocotools.coco import COCO
+from pycocotools.cocoeval import COCOeval
+
+# Eval results
+coco = COCO(gt_path) # `gt_path` is the ground-truth JSON path (different JSON for FULL, PRES or ABS settings in our paper)
+d3_model = coco.loadRes(pred_path) # `pred_path` is the prediction JSON file
+cocoEval = COCOeval(coco, d3_model, "bbox")
+cocoEval.evaluate()
+cocoEval.accumulate()
+cocoEval.summarize()
+```
+
+### An Off-the-shelf Script
+
+We also provide [a script](scripts/eval_and_analysis_json.py) that can produce the evaluation results (and some additional analysis) in our paper, given a prediction JSON.
+You can use it by:
+```shell
+python eval_and_analysis_json.py YOUR_PREDICTION_JSON_PATH
+```
+
+A few options are provided for format conversion or more analysis:
+```shell
+python eval_and_analysis_json.py --help
+
+usage: An example script for $D^3$ evaluation with prediction file (JSON) [-h] [--partition-by-nbox] [--partition-by-lens] [--xyxy2xywh] pred_path
+
+positional arguments:
+ pred_path path to prediction json
+
+optional arguments:
+ -h, --help show this help message and exit
+ --partition-by-nbox divide the images by num of boxes for each ref
+ --partition-by-lens divide the references by their lengths
+ --xyxy2xywh transform box coords from xyxy to xywh
+```
+
+
+### Evaluation Examples on SOTA Methods
+
+See [this directory](eval_sota/) for details. We include the evaluation scripts of some methods there.
+
+
+
+## Dataset Statistics
+
+[A python script](scripts/get_d3_stat.py) is provided for calculating the statistics of $D^3$ or visualizing figures like histograms, word clouds, etc.
+
+The specific statistics of the dataset are available in Section 3.3 of the DOD paper.
diff --git a/approach/ovod/mm-ovod/.gitmodules b/approach/ovod/mm-ovod/.gitmodules
new file mode 100644
index 0000000000000000000000000000000000000000..98d980505aae72f9291ebcfd19e82b3aa12822d2
--- /dev/null
+++ b/approach/ovod/mm-ovod/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "third_party/CenterNet2"]
+ path = third_party/CenterNet2
+ url = https://github.com/xingyizhou/CenterNet2.git
diff --git a/approach/ovod/mm-ovod/README.md b/approach/ovod/mm-ovod/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..0177519514a9d4f09620d36652d64e4362678cff
--- /dev/null
+++ b/approach/ovod/mm-ovod/README.md
@@ -0,0 +1,38 @@
+# Multi-Modal Classifiers for Open-Vocabulary Object Detection
+
+
+
diff --git a/approach/vlm/LLaVA/docs/LoRA.md b/approach/vlm/LLaVA/docs/LoRA.md
new file mode 100644
index 0000000000000000000000000000000000000000..369fe92579051f98a0724a92e52e65e014a0de2f
--- /dev/null
+++ b/approach/vlm/LLaVA/docs/LoRA.md
@@ -0,0 +1,46 @@
+# LLaVA (LoRA, Preview)
+
+NOTE: This is a technical preview, and is not yet ready for production use. We are still running hyperparameter search for the LoRA model, and will release the final model soon. If you'd like to contribute to this, please contact us.
+
+You need latest code base for LoRA support (instructions [here](https://github.com/haotian-liu/LLaVA#upgrade-to-latest-code-base))
+
+## Demo (Web UI)
+
+Please execute each of the command below one by one (after the previous one has finished). The commands are the same as launching other demos except for an additional `--model-base` flag to specify the base model to use. Please make sure the base model corresponds to the LoRA checkpoint that you are using. For this technical preview, you need Vicuna v1.1 (7B) checkpoint (if you do not have that already, follow the instructions [here](https://github.com/lm-sys/FastChat#vicuna-weights)).
+
+#### Launch a controller
+```Shell
+python -m llava.serve.controller --host 0.0.0.0 --port 10000
+```
+
+#### Launch a gradio web server.
+```Shell
+python -m llava.serve.gradio_web_server --controller http://localhost:10000 --model-list-mode reload
+```
+You just launched the Gradio web interface. Now, you can open the web interface with the URL printed on the screen. You may notice that there is no model in the model list. Do not worry, as we have not launched any model worker yet. It will be automatically updated when you launch a model worker.
+
+#### Launch a model worker
+```Shell
+python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path liuhaotian/llava-vicuna-7b-v1.1-lcs_558k-instruct_80k_3e-lora-preview-alpha --model-base /path/to/vicuna-v1.1
+```
+Wait until the process finishes loading the model and you see "Uvicorn running on ...". Now, refresh your Gradio web UI, and you will see the model you just launched in the model list.
+
+You can launch as many workers as you want, and compare between different model checkpoints in the same Gradio interface. Please keep the `--controller` the same, and modify the `--port` and `--worker` to a different port number for each worker.
+
+
+## Training
+
+Please see sample training scripts for [LoRA](https://github.com/haotian-liu/LLaVA/blob/main/scripts/finetune_lora.sh) and [QLoRA](https://github.com/haotian-liu/LLaVA/blob/main/scripts/finetune_qlora.sh).
+
+We provide sample DeepSpeed configs, [`zero3.json`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/zero3.json) is more like PyTorch FSDP, and [`zero3_offload.json`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/zero3_offload.json) can further save memory consumption by offloading parameters to CPU. `zero3.json` is usually faster than `zero3_offload.json` but requires more GPU memory, therefore, we recommend trying `zero3.json` first, and if you run out of GPU memory, try `zero3_offload.json`. You can also tweak the `per_device_train_batch_size` and `gradient_accumulation_steps` in the config to save memory, and just to make sure that `per_device_train_batch_size` and `gradient_accumulation_steps` remains the same.
+
+If you are having issues with ZeRO-3 configs, and there are enough VRAM, you may try [`zero2.json`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/zero2.json). This consumes slightly more memory than ZeRO-3, and behaves more similar to PyTorch FSDP, while still supporting parameter-efficient tuning.
+
+## Create Merged Checkpoints
+
+```Shell
+python scripts/merge_lora_weights.py \
+ --model-path /path/to/lora_model \
+ --model-base /path/to/base_model \
+ --save-model-path /path/to/merge_model
+```
diff --git a/approach/vlm/LLaVA/docs/MODEL_ZOO.md b/approach/vlm/LLaVA/docs/MODEL_ZOO.md
new file mode 100644
index 0000000000000000000000000000000000000000..3faf9fab3bb6eeaf332ad172a0fe747a386d298f
--- /dev/null
+++ b/approach/vlm/LLaVA/docs/MODEL_ZOO.md
@@ -0,0 +1,136 @@
+# Model Zoo
+
+**To Use LLaVA-1.5 checkpoints, your llava package version must be newer than 1.1.0. [Instructions](https://github.com/haotian-liu/LLaVA#upgrade-to-latest-code-base) on how to upgrade.**
+
+If you are interested in including any other details in Model Zoo, please open an issue :)
+
+The model weights below are *merged* weights. You do not need to apply delta. The usage of LLaVA checkpoints should comply with the base LLM's model license: [Llama 2](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md).
+
+## LLaVA-v1.5
+
+| Version | Size | Schedule | Checkpoint | VQAv2 | GQA | VizWiz | SQA | T-VQA | POPE | MME | MM-Bench | MM-Bench-CN | SEED | LLaVA-Bench-Wild | MM-Vet |
+|----------|----------|-----------|-----------|---|---|---|---|---|---|---|---|---|---|---|---|
+| LLaVA-1.5 | 7B | full_ft-1e | [liuhaotian/llava-v1.5-7b](https://huggingface.co/liuhaotian/llava-v1.5-7b) | 78.5 | 62.0 | 50.0 | 66.8 | 58.2 | 85.9 | 1510.7 | 64.3 | 58.3 | 58.6 | 63.4 | 30.5 |
+| LLaVA-1.5 | 13B | full_ft-1e | [liuhaotian/llava-v1.5-13b](https://huggingface.co/liuhaotian/llava-v1.5-13b) | 80.0 | 63.3 | 53.6 | 71.6 | 61.3 | 85.9 | 1531.3 | 67.7 | 63.6 | 61.6 | 70.7 | 35.4 |
+| LLaVA-1.5 | 7B | lora-1e | coming soon |
+| LLaVA-1.5 | 13B | lora-1e | coming soon |
+
+
+
+ LLaVA-1.5 achieves SoTA performance across 11 benchmarks.
+
+