Add files using upload-large-folder tool
Browse files- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/odinw13/odinw_text_and_visual.yaml +255 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/odinw13/odinw_text_only.yaml +253 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/odinw13/odinw_text_only_positive.yaml +253 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/odinw13/odinw_text_only_train.yaml +591 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/odinw13/odinw_visual_only.yaml +256 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/roboflow_v100/roboflow_v100_eval.yaml +539 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/roboflow_v100/roboflow_v100_full_ft_100_images.yaml +539 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/saco_video_evals/saco_veval_sav_test.yaml +174 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/saco_video_evals/saco_veval_sav_val.yaml +174 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/saco_video_evals/saco_veval_yt1b_test_noheur.yaml +174 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_bdd100k.yaml +64 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_droid.yaml +64 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_ego4d.yaml +64 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_fathomnet.yaml +64 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_food_rec.yaml +64 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_geode.yaml +64 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_inaturalist.yaml +64 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_nga.yaml +64 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_sav.yaml +64 -0
- 之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_yt1b.yaml +64 -0
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/odinw13/odinw_text_and_visual.yaml
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- _self_
|
| 4 |
+
|
| 5 |
+
# ============================================================================
|
| 6 |
+
# Paths Configuration (Chage this to your own paths)
|
| 7 |
+
# ============================================================================
|
| 8 |
+
# python sam3/train/train.py -c configs/odinw_text_only.yaml --use-cluster 1 --partition ${PARTITION} --account ${ACCOUNT} --qos ${QoS}
|
| 9 |
+
|
| 10 |
+
paths:
|
| 11 |
+
odinw_data_root: <YOUR_DATA_DIR>
|
| 12 |
+
experiment_log_dir: <YOUR EXPERIMENET LOG_DIR>
|
| 13 |
+
bpe_path: <BPE_PATH> # This should be under assets/bpe_simple_vocab_16e6.txt.gz
|
| 14 |
+
|
| 15 |
+
supercategory_tuple: ${all_odinw_supercategories.${string:${submitit.job_array.task_index}}}
|
| 16 |
+
# Validation transforms pipeline
|
| 17 |
+
val_transforms:
|
| 18 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 19 |
+
transforms:
|
| 20 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 21 |
+
sizes: ${scratch.resolution}
|
| 22 |
+
max_size:
|
| 23 |
+
_target_: sam3.train.transforms.basic.get_random_resize_max_size
|
| 24 |
+
size: ${scratch.resolution}
|
| 25 |
+
square: true
|
| 26 |
+
consistent_transform: False
|
| 27 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 28 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 29 |
+
mean: ${scratch.val_norm_mean}
|
| 30 |
+
std: ${scratch.val_norm_std}
|
| 31 |
+
- _target_: sam3.train.transforms.filter_query_transforms.TextQueryToVisual
|
| 32 |
+
keep_text_queries: true # Note: set this to false if you only want visual
|
| 33 |
+
probability: 1.0 # always
|
| 34 |
+
|
| 35 |
+
# ============================================================================
|
| 36 |
+
# Different helper parameters and functions
|
| 37 |
+
# ============================================================================
|
| 38 |
+
scratch:
|
| 39 |
+
enable_segmentation: True
|
| 40 |
+
# Box processing
|
| 41 |
+
use_presence_eval: True
|
| 42 |
+
original_box_postprocessor:
|
| 43 |
+
_target_: sam3.eval.postprocessors.PostProcessImage
|
| 44 |
+
max_dets_per_img: -1 # infinite detections
|
| 45 |
+
use_original_ids: true
|
| 46 |
+
use_original_sizes_box: true
|
| 47 |
+
use_presence: ${scratch.use_presence_eval}
|
| 48 |
+
|
| 49 |
+
# Image processing parameters
|
| 50 |
+
resolution: 1008
|
| 51 |
+
# Normalization parameters
|
| 52 |
+
val_norm_mean: [0.5, 0.5, 0.5]
|
| 53 |
+
val_norm_std: [0.5, 0.5, 0.5]
|
| 54 |
+
|
| 55 |
+
# Training parameters
|
| 56 |
+
val_batch_size: 2
|
| 57 |
+
num_val_workers: 0
|
| 58 |
+
gather_pred_via_filesys: false
|
| 59 |
+
|
| 60 |
+
# ============================================================================
|
| 61 |
+
# Trainer Configuration
|
| 62 |
+
# ============================================================================
|
| 63 |
+
|
| 64 |
+
trainer:
|
| 65 |
+
_target_: sam3.train.trainer.Trainer
|
| 66 |
+
skip_saving_ckpts: true
|
| 67 |
+
empty_gpu_mem_cache_after_eval: True
|
| 68 |
+
max_epochs: 1
|
| 69 |
+
accelerator: cuda
|
| 70 |
+
seed_value: 123
|
| 71 |
+
mode: val
|
| 72 |
+
|
| 73 |
+
distributed:
|
| 74 |
+
backend: nccl
|
| 75 |
+
find_unused_parameters: True
|
| 76 |
+
gradient_as_bucket_view: True
|
| 77 |
+
|
| 78 |
+
loss:
|
| 79 |
+
default:
|
| 80 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 81 |
+
|
| 82 |
+
data:
|
| 83 |
+
val:
|
| 84 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 85 |
+
dataset:
|
| 86 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 87 |
+
coco_json_loader:
|
| 88 |
+
_target_: sam3.train.data.coco_json_loaders.COCO_FROM_JSON
|
| 89 |
+
prompts: ${odinw35_prompts.${supercategory_tuple.name}}
|
| 90 |
+
include_negatives: true
|
| 91 |
+
category_chunk_size: 20 # Note: Since we are doing AP +ve we need to include all categories!
|
| 92 |
+
_partial_: true
|
| 93 |
+
img_folder: ${paths.odinw_data_root}/${supercategory_tuple.val.img_folder}
|
| 94 |
+
ann_file:
|
| 95 |
+
_target_: sam3.eval.coco_reindex.reindex_coco_to_temp
|
| 96 |
+
input_json_path: ${paths.odinw_data_root}/${supercategory_tuple.val.json}
|
| 97 |
+
transforms: ${val_transforms}
|
| 98 |
+
max_ann_per_img: 100000
|
| 99 |
+
multiplier: 1
|
| 100 |
+
training: false
|
| 101 |
+
|
| 102 |
+
shuffle: False
|
| 103 |
+
batch_size: ${scratch.val_batch_size}
|
| 104 |
+
num_workers: ${scratch.num_val_workers}
|
| 105 |
+
pin_memory: False
|
| 106 |
+
drop_last: False
|
| 107 |
+
collate_fn:
|
| 108 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 109 |
+
_partial_: true
|
| 110 |
+
repeats: 1
|
| 111 |
+
dict_key: odinw35
|
| 112 |
+
|
| 113 |
+
model:
|
| 114 |
+
_target_: sam3.model_builder.build_sam3_image_model
|
| 115 |
+
bpe_path: ${paths.bpe_path}
|
| 116 |
+
device: cpus
|
| 117 |
+
eval_mode: true # Set to false if training
|
| 118 |
+
enable_segmentation: ${scratch.enable_segmentation} # Warning: Enable this if using segmentation.
|
| 119 |
+
|
| 120 |
+
meters:
|
| 121 |
+
val:
|
| 122 |
+
odinw35:
|
| 123 |
+
detection:
|
| 124 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 125 |
+
iou_type: "bbox"
|
| 126 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/roboflow/${supercategory_tuple.name}
|
| 127 |
+
merge_predictions: True
|
| 128 |
+
postprocessor: ${scratch.original_box_postprocessor}
|
| 129 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 130 |
+
maxdets: 100
|
| 131 |
+
pred_file_evaluators:
|
| 132 |
+
- _target_: sam3.eval.coco_eval_offline.CocoEvaluatorOfflineWithPredFileEvaluators
|
| 133 |
+
gt_path:
|
| 134 |
+
_target_: sam3.eval.coco_reindex.reindex_coco_to_temp
|
| 135 |
+
input_json_path: ${paths.odinw_data_root}/${supercategory_tuple.val.json}
|
| 136 |
+
tide: False
|
| 137 |
+
iou_type: "bbox"
|
| 138 |
+
positive_split: true
|
| 139 |
+
|
| 140 |
+
checkpoint:
|
| 141 |
+
save_dir: ${launcher.experiment_log_dir}/checkpoints
|
| 142 |
+
save_freq: 0 # 0 only last checkpoint is saved.
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
logging:
|
| 146 |
+
tensorboard_writer:
|
| 147 |
+
_target_: sam3.train.utils.logger.make_tensorboard_logger
|
| 148 |
+
log_dir: ${launcher.experiment_log_dir}/tensorboard
|
| 149 |
+
flush_secs: 120
|
| 150 |
+
should_log: True
|
| 151 |
+
wandb_writer: null
|
| 152 |
+
log_dir: ${launcher.experiment_log_dir}/logs/${supercategory_tuple.name}
|
| 153 |
+
log_freq: 10
|
| 154 |
+
|
| 155 |
+
# ============================================================================
|
| 156 |
+
# Launcher and Submitit Configuration
|
| 157 |
+
# ============================================================================
|
| 158 |
+
|
| 159 |
+
launcher:
|
| 160 |
+
num_nodes: 1
|
| 161 |
+
gpus_per_node: 2
|
| 162 |
+
experiment_log_dir: ${paths.experiment_log_dir}
|
| 163 |
+
multiprocessing_context: forkserver
|
| 164 |
+
|
| 165 |
+
submitit:
|
| 166 |
+
account: null
|
| 167 |
+
partition: null
|
| 168 |
+
qos: null
|
| 169 |
+
timeout_hour: 72
|
| 170 |
+
use_cluster: True
|
| 171 |
+
cpus_per_task: 10
|
| 172 |
+
port_range: [10000, 65000]
|
| 173 |
+
constraint: null
|
| 174 |
+
|
| 175 |
+
job_array:
|
| 176 |
+
num_tasks: 13
|
| 177 |
+
task_index: 0
|
| 178 |
+
|
| 179 |
+
# ============================================================================
|
| 180 |
+
# ODinW13 Supercategories
|
| 181 |
+
# ============================================================================
|
| 182 |
+
|
| 183 |
+
all_odinw_supercategories:
|
| 184 |
+
- name: AerialMaritimeDrone_large
|
| 185 |
+
val:
|
| 186 |
+
img_folder: AerialMaritimeDrone/large/test/
|
| 187 |
+
json: AerialMaritimeDrone/large/test/annotations_without_background.json
|
| 188 |
+
- name: Aquarium
|
| 189 |
+
val:
|
| 190 |
+
img_folder: Aquarium/Aquarium Combined.v2-raw-1024.coco/test/
|
| 191 |
+
json: Aquarium/Aquarium Combined.v2-raw-1024.coco/test/annotations_without_background.json
|
| 192 |
+
- name: CottontailRabbits
|
| 193 |
+
val:
|
| 194 |
+
img_folder: CottontailRabbits/test/
|
| 195 |
+
json: CottontailRabbits/test/annotations_without_background.json
|
| 196 |
+
- name: EgoHands_generic
|
| 197 |
+
val:
|
| 198 |
+
img_folder: EgoHands/generic/test/
|
| 199 |
+
json: EgoHands/generic/test/annotations_without_background.json
|
| 200 |
+
- name: NorthAmericaMushrooms
|
| 201 |
+
val:
|
| 202 |
+
img_folder: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/test/
|
| 203 |
+
json: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/test/annotations_without_background.json
|
| 204 |
+
- name: Packages
|
| 205 |
+
val:
|
| 206 |
+
img_folder: Packages/Raw/test/
|
| 207 |
+
json: Packages/Raw/test/annotations_without_background.json
|
| 208 |
+
- name: PascalVOC
|
| 209 |
+
val:
|
| 210 |
+
img_folder: PascalVOC/valid/
|
| 211 |
+
json: PascalVOC/valid/annotations_without_background.json
|
| 212 |
+
- name: Raccoon
|
| 213 |
+
val:
|
| 214 |
+
img_folder: Raccoon/Raccoon.v2-raw.coco/test/
|
| 215 |
+
json: Raccoon/Raccoon.v2-raw.coco/test/annotations_without_background.json
|
| 216 |
+
- name: ShellfishOpenImages
|
| 217 |
+
val:
|
| 218 |
+
img_folder: ShellfishOpenImages/raw/test/
|
| 219 |
+
json: ShellfishOpenImages/raw/test/annotations_without_background.json
|
| 220 |
+
- name: VehiclesOpenImages
|
| 221 |
+
val:
|
| 222 |
+
img_folder: VehiclesOpenImages/416x416/test/
|
| 223 |
+
json: VehiclesOpenImages/416x416/test/annotations_without_background.json
|
| 224 |
+
- name: pistols
|
| 225 |
+
val:
|
| 226 |
+
img_folder: pistols/export/
|
| 227 |
+
json: pistols/export/test_annotations_without_background.json
|
| 228 |
+
- name: pothole
|
| 229 |
+
val:
|
| 230 |
+
img_folder: pothole/test/
|
| 231 |
+
json: pothole/test/annotations_without_background.json
|
| 232 |
+
- name: thermalDogsAndPeople
|
| 233 |
+
val:
|
| 234 |
+
img_folder: thermalDogsAndPeople/test/
|
| 235 |
+
json: thermalDogsAndPeople/test/annotations_without_background.json
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
odinw35_prompts:
|
| 239 |
+
AerialMaritimeDrone_large: '[{"id": 1, "name": "boat", "supercategory": "movable-objects"},
|
| 240 |
+
{"id": 2, "name": "car", "supercategory": "movable-objects"}, {"id": 3, "name": "dock",
|
| 241 |
+
"supercategory": "movable-objects"}, {"id": 4, "name": "jet ski", "supercategory": "movable-objects"},
|
| 242 |
+
{"id": 5, "name": "boat lift", "supercategory": "movable-objects"}]'
|
| 243 |
+
Aquarium: null
|
| 244 |
+
CottontailRabbits: null
|
| 245 |
+
EgoHands_generic: null
|
| 246 |
+
NorthAmericaMushrooms: '[{''id'': 1, ''name'':
|
| 247 |
+
''chicken of the woods'', ''supercategory'': ''mushroom''}, {''id'': 2, ''name'': ''chanterelle'', ''supercategory'': ''mushroom''}]'
|
| 248 |
+
Packages: null
|
| 249 |
+
PascalVOC: null
|
| 250 |
+
Raccoon: null
|
| 251 |
+
ShellfishOpenImages: null
|
| 252 |
+
VehiclesOpenImages: null
|
| 253 |
+
pistols: null
|
| 254 |
+
pothole: null
|
| 255 |
+
thermalDogsAndPeople: null
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/odinw13/odinw_text_only.yaml
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- _self_
|
| 4 |
+
|
| 5 |
+
# ============================================================================
|
| 6 |
+
# Paths Configuration (Chage this to your own paths)
|
| 7 |
+
# ============================================================================
|
| 8 |
+
# python sam3/train/train.py -c configs/odinw_text_only.yaml --use-cluster 1 --partition ${PARTITION} --account ${ACCOUNT} --qos ${QoS}
|
| 9 |
+
|
| 10 |
+
paths:
|
| 11 |
+
odinw_data_root: <YOUR_DATA_DIR>
|
| 12 |
+
experiment_log_dir: <YOUR EXPERIMENET LOG_DIR>
|
| 13 |
+
bpe_path: <BPE_PATH> # This should be under assets/bpe_simple_vocab_16e6.txt.gz
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
supercategory_tuple: ${all_odinw_supercategories.${string:${submitit.job_array.task_index}}}
|
| 17 |
+
# Validation transforms pipeline
|
| 18 |
+
val_transforms:
|
| 19 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 20 |
+
transforms:
|
| 21 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 22 |
+
sizes: ${scratch.resolution}
|
| 23 |
+
max_size:
|
| 24 |
+
_target_: sam3.train.transforms.basic.get_random_resize_max_size
|
| 25 |
+
size: ${scratch.resolution}
|
| 26 |
+
square: true
|
| 27 |
+
consistent_transform: False
|
| 28 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 29 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 30 |
+
mean: ${scratch.val_norm_mean}
|
| 31 |
+
std: ${scratch.val_norm_std}
|
| 32 |
+
|
| 33 |
+
# ============================================================================
|
| 34 |
+
# Different helper parameters and functions
|
| 35 |
+
# ============================================================================
|
| 36 |
+
scratch:
|
| 37 |
+
enable_segmentation: True
|
| 38 |
+
# Box processing
|
| 39 |
+
use_presence_eval: True
|
| 40 |
+
original_box_postprocessor:
|
| 41 |
+
_target_: sam3.eval.postprocessors.PostProcessImage
|
| 42 |
+
max_dets_per_img: -1 # infinite detections
|
| 43 |
+
use_original_ids: true
|
| 44 |
+
use_original_sizes_box: true
|
| 45 |
+
use_presence: ${scratch.use_presence_eval}
|
| 46 |
+
|
| 47 |
+
# Image processing parameters
|
| 48 |
+
resolution: 1008
|
| 49 |
+
# Normalization parameters
|
| 50 |
+
val_norm_mean: [0.5, 0.5, 0.5]
|
| 51 |
+
val_norm_std: [0.5, 0.5, 0.5]
|
| 52 |
+
|
| 53 |
+
# Training parameters
|
| 54 |
+
val_batch_size: 2
|
| 55 |
+
num_val_workers: 0
|
| 56 |
+
gather_pred_via_filesys: false
|
| 57 |
+
|
| 58 |
+
# ============================================================================
|
| 59 |
+
# Trainer Configuration
|
| 60 |
+
# ============================================================================
|
| 61 |
+
|
| 62 |
+
trainer:
|
| 63 |
+
_target_: sam3.train.trainer.Trainer
|
| 64 |
+
skip_saving_ckpts: true
|
| 65 |
+
empty_gpu_mem_cache_after_eval: True
|
| 66 |
+
max_epochs: 1
|
| 67 |
+
accelerator: cuda
|
| 68 |
+
seed_value: 123
|
| 69 |
+
mode: val
|
| 70 |
+
|
| 71 |
+
distributed:
|
| 72 |
+
backend: nccl
|
| 73 |
+
find_unused_parameters: True
|
| 74 |
+
gradient_as_bucket_view: True
|
| 75 |
+
|
| 76 |
+
loss:
|
| 77 |
+
default:
|
| 78 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 79 |
+
|
| 80 |
+
data:
|
| 81 |
+
val:
|
| 82 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 83 |
+
dataset:
|
| 84 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 85 |
+
coco_json_loader:
|
| 86 |
+
_target_: sam3.train.data.coco_json_loaders.COCO_FROM_JSON
|
| 87 |
+
prompts: ${odinw35_prompts.${supercategory_tuple.name}}
|
| 88 |
+
include_negatives: true
|
| 89 |
+
category_chunk_size: 20 # Note: Since we are doing AP +ve we need to include all categories!
|
| 90 |
+
_partial_: true
|
| 91 |
+
img_folder: ${paths.odinw_data_root}/${supercategory_tuple.val.img_folder}
|
| 92 |
+
ann_file:
|
| 93 |
+
_target_: sam3.eval.coco_reindex.reindex_coco_to_temp
|
| 94 |
+
input_json_path: ${paths.odinw_data_root}/${supercategory_tuple.val.json}
|
| 95 |
+
transforms: ${val_transforms}
|
| 96 |
+
max_ann_per_img: 100000
|
| 97 |
+
multiplier: 1
|
| 98 |
+
training: false
|
| 99 |
+
|
| 100 |
+
shuffle: False
|
| 101 |
+
batch_size: ${scratch.val_batch_size}
|
| 102 |
+
num_workers: ${scratch.num_val_workers}
|
| 103 |
+
pin_memory: False
|
| 104 |
+
drop_last: False
|
| 105 |
+
collate_fn:
|
| 106 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 107 |
+
_partial_: true
|
| 108 |
+
repeats: 1
|
| 109 |
+
dict_key: odinw35
|
| 110 |
+
|
| 111 |
+
model:
|
| 112 |
+
_target_: sam3.model_builder.build_sam3_image_model
|
| 113 |
+
bpe_path: ${paths.bpe_path}
|
| 114 |
+
device: cpus
|
| 115 |
+
eval_mode: true # Set to false if training
|
| 116 |
+
enable_segmentation: ${scratch.enable_segmentation} # Warning: Enable this if using segmentation.
|
| 117 |
+
|
| 118 |
+
meters:
|
| 119 |
+
val:
|
| 120 |
+
odinw35:
|
| 121 |
+
detection:
|
| 122 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 123 |
+
iou_type: "bbox"
|
| 124 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/odinw/${supercategory_tuple.name}
|
| 125 |
+
merge_predictions: True
|
| 126 |
+
postprocessor: ${scratch.original_box_postprocessor}
|
| 127 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 128 |
+
maxdets: 100
|
| 129 |
+
pred_file_evaluators:
|
| 130 |
+
- _target_: sam3.eval.coco_eval_offline.CocoEvaluatorOfflineWithPredFileEvaluators
|
| 131 |
+
gt_path:
|
| 132 |
+
_target_: sam3.eval.coco_reindex.reindex_coco_to_temp
|
| 133 |
+
input_json_path: ${paths.odinw_data_root}/${supercategory_tuple.val.json}
|
| 134 |
+
tide: False
|
| 135 |
+
iou_type: "bbox"
|
| 136 |
+
positive_split: False
|
| 137 |
+
|
| 138 |
+
checkpoint:
|
| 139 |
+
save_dir: ${launcher.experiment_log_dir}/checkpoints
|
| 140 |
+
save_freq: 0 # 0 only last checkpoint is saved.
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
logging:
|
| 144 |
+
tensorboard_writer:
|
| 145 |
+
_target_: sam3.train.utils.logger.make_tensorboard_logger
|
| 146 |
+
log_dir: ${launcher.experiment_log_dir}/tensorboard
|
| 147 |
+
flush_secs: 120
|
| 148 |
+
should_log: True
|
| 149 |
+
wandb_writer: null
|
| 150 |
+
log_dir: ${launcher.experiment_log_dir}/logs/${supercategory_tuple.name}
|
| 151 |
+
log_freq: 10
|
| 152 |
+
|
| 153 |
+
# ============================================================================
|
| 154 |
+
# Launcher and Submitit Configuration
|
| 155 |
+
# ============================================================================
|
| 156 |
+
|
| 157 |
+
launcher:
|
| 158 |
+
num_nodes: 1
|
| 159 |
+
gpus_per_node: 2
|
| 160 |
+
experiment_log_dir: ${paths.experiment_log_dir}
|
| 161 |
+
multiprocessing_context: forkserver
|
| 162 |
+
|
| 163 |
+
submitit:
|
| 164 |
+
account: null
|
| 165 |
+
partition: null
|
| 166 |
+
qos: null
|
| 167 |
+
timeout_hour: 72
|
| 168 |
+
use_cluster: True
|
| 169 |
+
cpus_per_task: 10
|
| 170 |
+
port_range: [10000, 65000]
|
| 171 |
+
constraint: null
|
| 172 |
+
|
| 173 |
+
job_array:
|
| 174 |
+
num_tasks: 13
|
| 175 |
+
task_index: 0
|
| 176 |
+
|
| 177 |
+
# ============================================================================
|
| 178 |
+
# ODinW13 Supercategories
|
| 179 |
+
# ============================================================================
|
| 180 |
+
|
| 181 |
+
all_odinw_supercategories:
|
| 182 |
+
- name: AerialMaritimeDrone_large
|
| 183 |
+
val:
|
| 184 |
+
img_folder: AerialMaritimeDrone/large/test/
|
| 185 |
+
json: AerialMaritimeDrone/large/test/annotations_without_background.json
|
| 186 |
+
- name: Aquarium
|
| 187 |
+
val:
|
| 188 |
+
img_folder: Aquarium/Aquarium Combined.v2-raw-1024.coco/test/
|
| 189 |
+
json: Aquarium/Aquarium Combined.v2-raw-1024.coco/test/annotations_without_background.json
|
| 190 |
+
- name: CottontailRabbits
|
| 191 |
+
val:
|
| 192 |
+
img_folder: CottontailRabbits/test/
|
| 193 |
+
json: CottontailRabbits/test/annotations_without_background.json
|
| 194 |
+
- name: EgoHands_generic
|
| 195 |
+
val:
|
| 196 |
+
img_folder: EgoHands/generic/test/
|
| 197 |
+
json: EgoHands/generic/test/annotations_without_background.json
|
| 198 |
+
- name: NorthAmericaMushrooms
|
| 199 |
+
val:
|
| 200 |
+
img_folder: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/test/
|
| 201 |
+
json: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/test/annotations_without_background.json
|
| 202 |
+
- name: Packages
|
| 203 |
+
val:
|
| 204 |
+
img_folder: Packages/Raw/test/
|
| 205 |
+
json: Packages/Raw/test/annotations_without_background.json
|
| 206 |
+
- name: PascalVOC
|
| 207 |
+
val:
|
| 208 |
+
img_folder: PascalVOC/valid/
|
| 209 |
+
json: PascalVOC/valid/annotations_without_background.json
|
| 210 |
+
- name: Raccoon
|
| 211 |
+
val:
|
| 212 |
+
img_folder: Raccoon/Raccoon.v2-raw.coco/test/
|
| 213 |
+
json: Raccoon/Raccoon.v2-raw.coco/test/annotations_without_background.json
|
| 214 |
+
- name: ShellfishOpenImages
|
| 215 |
+
val:
|
| 216 |
+
img_folder: ShellfishOpenImages/raw/test/
|
| 217 |
+
json: ShellfishOpenImages/raw/test/annotations_without_background.json
|
| 218 |
+
- name: VehiclesOpenImages
|
| 219 |
+
val:
|
| 220 |
+
img_folder: VehiclesOpenImages/416x416/test/
|
| 221 |
+
json: VehiclesOpenImages/416x416/test/annotations_without_background.json
|
| 222 |
+
- name: pistols
|
| 223 |
+
val:
|
| 224 |
+
img_folder: pistols/export/
|
| 225 |
+
json: pistols/export/test_annotations_without_background.json
|
| 226 |
+
- name: pothole
|
| 227 |
+
val:
|
| 228 |
+
img_folder: pothole/test/
|
| 229 |
+
json: pothole/test/annotations_without_background.json
|
| 230 |
+
- name: thermalDogsAndPeople
|
| 231 |
+
val:
|
| 232 |
+
img_folder: thermalDogsAndPeople/test/
|
| 233 |
+
json: thermalDogsAndPeople/test/annotations_without_background.json
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
odinw35_prompts:
|
| 237 |
+
AerialMaritimeDrone_large: '[{"id": 1, "name": "boat", "supercategory": "movable-objects"},
|
| 238 |
+
{"id": 2, "name": "car", "supercategory": "movable-objects"}, {"id": 3, "name": "dock",
|
| 239 |
+
"supercategory": "movable-objects"}, {"id": 4, "name": "jet ski", "supercategory": "movable-objects"},
|
| 240 |
+
{"id": 5, "name": "boat lift", "supercategory": "movable-objects"}]'
|
| 241 |
+
Aquarium: null
|
| 242 |
+
CottontailRabbits: null
|
| 243 |
+
EgoHands_generic: null
|
| 244 |
+
NorthAmericaMushrooms: '[{''id'': 1, ''name'':
|
| 245 |
+
''chicken of the woods'', ''supercategory'': ''mushroom''}, {''id'': 2, ''name'': ''chanterelle'', ''supercategory'': ''mushroom''}]'
|
| 246 |
+
Packages: null
|
| 247 |
+
PascalVOC: null
|
| 248 |
+
Raccoon: null
|
| 249 |
+
ShellfishOpenImages: null
|
| 250 |
+
VehiclesOpenImages: null
|
| 251 |
+
pistols: null
|
| 252 |
+
pothole: null
|
| 253 |
+
thermalDogsAndPeople: null
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/odinw13/odinw_text_only_positive.yaml
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- _self_
|
| 4 |
+
|
| 5 |
+
# ============================================================================
|
| 6 |
+
# Paths Configuration (Chage this to your own paths)
|
| 7 |
+
# ============================================================================
|
| 8 |
+
# python sam3/train/train.py -c configs/odinw_text_only.yaml --use-cluster 1 --partition ${PARTITION} --account ${ACCOUNT} --qos ${QoS}
|
| 9 |
+
|
| 10 |
+
paths:
|
| 11 |
+
odinw_data_root: <YOUR_DATA_DIR>
|
| 12 |
+
experiment_log_dir: <YOUR EXPERIMENET LOG_DIR>
|
| 13 |
+
bpe_path: <BPE_PATH> # This should be under assets/bpe_simple_vocab_16e6.txt.gz
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
supercategory_tuple: ${all_odinw_supercategories.${string:${submitit.job_array.task_index}}}
|
| 17 |
+
# Validation transforms pipeline
|
| 18 |
+
val_transforms:
|
| 19 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 20 |
+
transforms:
|
| 21 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 22 |
+
sizes: ${scratch.resolution}
|
| 23 |
+
max_size:
|
| 24 |
+
_target_: sam3.train.transforms.basic.get_random_resize_max_size
|
| 25 |
+
size: ${scratch.resolution}
|
| 26 |
+
square: true
|
| 27 |
+
consistent_transform: False
|
| 28 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 29 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 30 |
+
mean: ${scratch.val_norm_mean}
|
| 31 |
+
std: ${scratch.val_norm_std}
|
| 32 |
+
|
| 33 |
+
# ============================================================================
|
| 34 |
+
# Different helper parameters and functions
|
| 35 |
+
# ============================================================================
|
| 36 |
+
scratch:
|
| 37 |
+
enable_segmentation: True
|
| 38 |
+
# Box processing
|
| 39 |
+
use_presence_eval: True
|
| 40 |
+
original_box_postprocessor:
|
| 41 |
+
_target_: sam3.eval.postprocessors.PostProcessImage
|
| 42 |
+
max_dets_per_img: -1 # infinite detections
|
| 43 |
+
use_original_ids: true
|
| 44 |
+
use_original_sizes_box: true
|
| 45 |
+
use_presence: ${scratch.use_presence_eval}
|
| 46 |
+
|
| 47 |
+
# Image processing parameters
|
| 48 |
+
resolution: 1008
|
| 49 |
+
# Normalization parameters
|
| 50 |
+
val_norm_mean: [0.5, 0.5, 0.5]
|
| 51 |
+
val_norm_std: [0.5, 0.5, 0.5]
|
| 52 |
+
|
| 53 |
+
# Training parameters
|
| 54 |
+
val_batch_size: 2
|
| 55 |
+
num_val_workers: 0
|
| 56 |
+
gather_pred_via_filesys: false
|
| 57 |
+
|
| 58 |
+
# ============================================================================
|
| 59 |
+
# Trainer Configuration
|
| 60 |
+
# ============================================================================
|
| 61 |
+
|
| 62 |
+
trainer:
|
| 63 |
+
_target_: sam3.train.trainer.Trainer
|
| 64 |
+
skip_saving_ckpts: true
|
| 65 |
+
empty_gpu_mem_cache_after_eval: True
|
| 66 |
+
max_epochs: 1
|
| 67 |
+
accelerator: cuda
|
| 68 |
+
seed_value: 123
|
| 69 |
+
mode: val
|
| 70 |
+
|
| 71 |
+
distributed:
|
| 72 |
+
backend: nccl
|
| 73 |
+
find_unused_parameters: True
|
| 74 |
+
gradient_as_bucket_view: True
|
| 75 |
+
|
| 76 |
+
loss:
|
| 77 |
+
default:
|
| 78 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 79 |
+
|
| 80 |
+
data:
|
| 81 |
+
val:
|
| 82 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 83 |
+
dataset:
|
| 84 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 85 |
+
coco_json_loader:
|
| 86 |
+
_target_: sam3.train.data.coco_json_loaders.COCO_FROM_JSON
|
| 87 |
+
prompts: ${odinw35_prompts.${supercategory_tuple.name}}
|
| 88 |
+
include_negatives: true
|
| 89 |
+
category_chunk_size: 20 # Note: Since we are doing AP +ve we need to include all categories!
|
| 90 |
+
_partial_: true
|
| 91 |
+
img_folder: ${paths.odinw_data_root}/${supercategory_tuple.val.img_folder}
|
| 92 |
+
ann_file:
|
| 93 |
+
_target_: sam3.eval.coco_reindex.reindex_coco_to_temp
|
| 94 |
+
input_json_path: ${paths.odinw_data_root}/${supercategory_tuple.val.json}
|
| 95 |
+
transforms: ${val_transforms}
|
| 96 |
+
max_ann_per_img: 100000
|
| 97 |
+
multiplier: 1
|
| 98 |
+
training: false
|
| 99 |
+
|
| 100 |
+
shuffle: False
|
| 101 |
+
batch_size: ${scratch.val_batch_size}
|
| 102 |
+
num_workers: ${scratch.num_val_workers}
|
| 103 |
+
pin_memory: False
|
| 104 |
+
drop_last: False
|
| 105 |
+
collate_fn:
|
| 106 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 107 |
+
_partial_: true
|
| 108 |
+
repeats: 1
|
| 109 |
+
dict_key: odinw35
|
| 110 |
+
|
| 111 |
+
model:
|
| 112 |
+
_target_: sam3.model_builder.build_sam3_image_model
|
| 113 |
+
bpe_path: ${paths.bpe_path}
|
| 114 |
+
device: cpus
|
| 115 |
+
eval_mode: true # Set to false if training
|
| 116 |
+
enable_segmentation: ${scratch.enable_segmentation} # Warning: Enable this if using segmentation.
|
| 117 |
+
|
| 118 |
+
meters:
|
| 119 |
+
val:
|
| 120 |
+
odinw35:
|
| 121 |
+
detection:
|
| 122 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 123 |
+
iou_type: "bbox"
|
| 124 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/roboflow/${supercategory_tuple.name}
|
| 125 |
+
merge_predictions: True
|
| 126 |
+
postprocessor: ${scratch.original_box_postprocessor}
|
| 127 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 128 |
+
maxdets: 100
|
| 129 |
+
pred_file_evaluators:
|
| 130 |
+
- _target_: sam3.eval.coco_eval_offline.CocoEvaluatorOfflineWithPredFileEvaluators
|
| 131 |
+
gt_path:
|
| 132 |
+
_target_: sam3.eval.coco_reindex.reindex_coco_to_temp
|
| 133 |
+
input_json_path: ${paths.odinw_data_root}/${supercategory_tuple.val.json}
|
| 134 |
+
tide: False
|
| 135 |
+
iou_type: "bbox"
|
| 136 |
+
positive_split: true
|
| 137 |
+
|
| 138 |
+
checkpoint:
|
| 139 |
+
save_dir: ${launcher.experiment_log_dir}/checkpoints
|
| 140 |
+
save_freq: 0 # 0 only last checkpoint is saved.
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
logging:
|
| 144 |
+
tensorboard_writer:
|
| 145 |
+
_target_: sam3.train.utils.logger.make_tensorboard_logger
|
| 146 |
+
log_dir: ${launcher.experiment_log_dir}/tensorboard
|
| 147 |
+
flush_secs: 120
|
| 148 |
+
should_log: True
|
| 149 |
+
wandb_writer: null
|
| 150 |
+
log_dir: ${launcher.experiment_log_dir}/logs/${supercategory_tuple.name}
|
| 151 |
+
log_freq: 10
|
| 152 |
+
|
| 153 |
+
# ============================================================================
|
| 154 |
+
# Launcher and Submitit Configuration
|
| 155 |
+
# ============================================================================
|
| 156 |
+
|
| 157 |
+
launcher:
|
| 158 |
+
num_nodes: 1
|
| 159 |
+
gpus_per_node: 2
|
| 160 |
+
experiment_log_dir: ${paths.experiment_log_dir}
|
| 161 |
+
multiprocessing_context: forkserver
|
| 162 |
+
|
| 163 |
+
submitit:
|
| 164 |
+
account: null
|
| 165 |
+
partition: null
|
| 166 |
+
qos: null
|
| 167 |
+
timeout_hour: 72
|
| 168 |
+
use_cluster: True
|
| 169 |
+
cpus_per_task: 10
|
| 170 |
+
port_range: [10000, 65000]
|
| 171 |
+
constraint: null
|
| 172 |
+
|
| 173 |
+
job_array:
|
| 174 |
+
num_tasks: 13
|
| 175 |
+
task_index: 0
|
| 176 |
+
|
| 177 |
+
# ============================================================================
|
| 178 |
+
# ODinW13 Supercategories
|
| 179 |
+
# ============================================================================
|
| 180 |
+
|
| 181 |
+
all_odinw_supercategories:
|
| 182 |
+
- name: AerialMaritimeDrone_large
|
| 183 |
+
val:
|
| 184 |
+
img_folder: AerialMaritimeDrone/large/test/
|
| 185 |
+
json: AerialMaritimeDrone/large/test/annotations_without_background.json
|
| 186 |
+
- name: Aquarium
|
| 187 |
+
val:
|
| 188 |
+
img_folder: Aquarium/Aquarium Combined.v2-raw-1024.coco/test/
|
| 189 |
+
json: Aquarium/Aquarium Combined.v2-raw-1024.coco/test/annotations_without_background.json
|
| 190 |
+
- name: CottontailRabbits
|
| 191 |
+
val:
|
| 192 |
+
img_folder: CottontailRabbits/test/
|
| 193 |
+
json: CottontailRabbits/test/annotations_without_background.json
|
| 194 |
+
- name: EgoHands_generic
|
| 195 |
+
val:
|
| 196 |
+
img_folder: EgoHands/generic/test/
|
| 197 |
+
json: EgoHands/generic/test/annotations_without_background.json
|
| 198 |
+
- name: NorthAmericaMushrooms
|
| 199 |
+
val:
|
| 200 |
+
img_folder: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/test/
|
| 201 |
+
json: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/test/annotations_without_background.json
|
| 202 |
+
- name: Packages
|
| 203 |
+
val:
|
| 204 |
+
img_folder: Packages/Raw/test/
|
| 205 |
+
json: Packages/Raw/test/annotations_without_background.json
|
| 206 |
+
- name: PascalVOC
|
| 207 |
+
val:
|
| 208 |
+
img_folder: PascalVOC/valid/
|
| 209 |
+
json: PascalVOC/valid/annotations_without_background.json
|
| 210 |
+
- name: Raccoon
|
| 211 |
+
val:
|
| 212 |
+
img_folder: Raccoon/Raccoon.v2-raw.coco/test/
|
| 213 |
+
json: Raccoon/Raccoon.v2-raw.coco/test/annotations_without_background.json
|
| 214 |
+
- name: ShellfishOpenImages
|
| 215 |
+
val:
|
| 216 |
+
img_folder: ShellfishOpenImages/raw/test/
|
| 217 |
+
json: ShellfishOpenImages/raw/test/annotations_without_background.json
|
| 218 |
+
- name: VehiclesOpenImages
|
| 219 |
+
val:
|
| 220 |
+
img_folder: VehiclesOpenImages/416x416/test/
|
| 221 |
+
json: VehiclesOpenImages/416x416/test/annotations_without_background.json
|
| 222 |
+
- name: pistols
|
| 223 |
+
val:
|
| 224 |
+
img_folder: pistols/export/
|
| 225 |
+
json: pistols/export/test_annotations_without_background.json
|
| 226 |
+
- name: pothole
|
| 227 |
+
val:
|
| 228 |
+
img_folder: pothole/test/
|
| 229 |
+
json: pothole/test/annotations_without_background.json
|
| 230 |
+
- name: thermalDogsAndPeople
|
| 231 |
+
val:
|
| 232 |
+
img_folder: thermalDogsAndPeople/test/
|
| 233 |
+
json: thermalDogsAndPeople/test/annotations_without_background.json
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
odinw35_prompts:
|
| 237 |
+
AerialMaritimeDrone_large: '[{"id": 1, "name": "boat", "supercategory": "movable-objects"},
|
| 238 |
+
{"id": 2, "name": "car", "supercategory": "movable-objects"}, {"id": 3, "name": "dock",
|
| 239 |
+
"supercategory": "movable-objects"}, {"id": 4, "name": "jet ski", "supercategory": "movable-objects"},
|
| 240 |
+
{"id": 5, "name": "boat lift", "supercategory": "movable-objects"}]'
|
| 241 |
+
Aquarium: null
|
| 242 |
+
CottontailRabbits: null
|
| 243 |
+
EgoHands_generic: null
|
| 244 |
+
NorthAmericaMushrooms: '[{''id'': 1, ''name'':
|
| 245 |
+
''chicken of the woods'', ''supercategory'': ''mushroom''}, {''id'': 2, ''name'': ''chanterelle'', ''supercategory'': ''mushroom''}]'
|
| 246 |
+
Packages: null
|
| 247 |
+
PascalVOC: null
|
| 248 |
+
Raccoon: null
|
| 249 |
+
ShellfishOpenImages: null
|
| 250 |
+
VehiclesOpenImages: null
|
| 251 |
+
pistols: null
|
| 252 |
+
pothole: null
|
| 253 |
+
thermalDogsAndPeople: null
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/odinw13/odinw_text_only_train.yaml
ADDED
|
@@ -0,0 +1,591 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- _self_
|
| 4 |
+
|
| 5 |
+
# ============================================================================
|
| 6 |
+
# Paths Configuration (Chage this to your own paths)
|
| 7 |
+
# ============================================================================
|
| 8 |
+
# python sam3/train/train.py -c configs/odinw_text_only.yaml --use-cluster 1 --partition ${PARTITION} --account ${ACCOUNT} --qos ${QoS}
|
| 9 |
+
|
| 10 |
+
paths:
|
| 11 |
+
odinw_data_root: <YOUR_DATA_DIR>
|
| 12 |
+
experiment_log_dir: <YOUR EXPERIMENET LOG_DIR>
|
| 13 |
+
bpe_path: <BPE_PATH> # This should be under assets/bpe_simple_vocab_16e6.txt.gz
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
odinw_train:
|
| 17 |
+
train_file: fewshot_train_shot10_seed300
|
| 18 |
+
num_images: null
|
| 19 |
+
supercategory_tuple: ${all_odinw_supercategories.${string:${submitit.job_array.task_index}}}
|
| 20 |
+
# Training transforms pipeline
|
| 21 |
+
train_transforms:
|
| 22 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 23 |
+
transforms:
|
| 24 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 25 |
+
query_filter:
|
| 26 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterCrowds
|
| 27 |
+
- _target_: sam3.train.transforms.point_sampling.RandomizeInputBbox
|
| 28 |
+
box_noise_std: 0.1
|
| 29 |
+
box_noise_max: 20
|
| 30 |
+
- _target_: sam3.train.transforms.segmentation.DecodeRle
|
| 31 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 32 |
+
sizes:
|
| 33 |
+
_target_: sam3.train.transforms.basic.get_random_resize_scales
|
| 34 |
+
size: ${scratch.resolution}
|
| 35 |
+
min_size: 480
|
| 36 |
+
rounded: false
|
| 37 |
+
max_size:
|
| 38 |
+
_target_: sam3.train.transforms.basic.get_random_resize_max_size
|
| 39 |
+
size: ${scratch.resolution}
|
| 40 |
+
square: true
|
| 41 |
+
consistent_transform: ${scratch.consistent_transform}
|
| 42 |
+
- _target_: sam3.train.transforms.basic_for_api.PadToSizeAPI
|
| 43 |
+
size: ${scratch.resolution}
|
| 44 |
+
consistent_transform: ${scratch.consistent_transform}
|
| 45 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 46 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 47 |
+
query_filter:
|
| 48 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterEmptyTargets
|
| 49 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 50 |
+
mean: ${scratch.train_norm_mean}
|
| 51 |
+
std: ${scratch.train_norm_std}
|
| 52 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 53 |
+
query_filter:
|
| 54 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterEmptyTargets
|
| 55 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 56 |
+
query_filter:
|
| 57 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterFindQueriesWithTooManyOut
|
| 58 |
+
max_num_objects: ${scratch.max_ann_per_img}
|
| 59 |
+
|
| 60 |
+
# Validation transforms pipeline
|
| 61 |
+
val_transforms:
|
| 62 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 63 |
+
transforms:
|
| 64 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 65 |
+
sizes: ${scratch.resolution}
|
| 66 |
+
max_size:
|
| 67 |
+
_target_: sam3.train.transforms.basic.get_random_resize_max_size
|
| 68 |
+
size: ${scratch.resolution}
|
| 69 |
+
square: true
|
| 70 |
+
consistent_transform: False
|
| 71 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 72 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 73 |
+
mean: ${scratch.val_norm_mean}
|
| 74 |
+
std: ${scratch.val_norm_std}
|
| 75 |
+
|
| 76 |
+
# loss config (no mask loss)
|
| 77 |
+
loss:
|
| 78 |
+
_target_: sam3.train.loss.sam3_loss.Sam3LossWrapper
|
| 79 |
+
matcher: ${scratch.matcher}
|
| 80 |
+
o2m_weight: 2.0
|
| 81 |
+
o2m_matcher:
|
| 82 |
+
_target_: sam3.train.matcher.BinaryOneToManyMatcher
|
| 83 |
+
alpha: 0.3
|
| 84 |
+
threshold: 0.4
|
| 85 |
+
topk: 4
|
| 86 |
+
use_o2m_matcher_on_o2m_aux: ${scratch.use_o2m_matcher_on_o2m_aux}
|
| 87 |
+
loss_fns_find:
|
| 88 |
+
- _target_: sam3.train.loss.loss_fns.Boxes
|
| 89 |
+
weight_dict:
|
| 90 |
+
loss_bbox: 5.0
|
| 91 |
+
loss_giou: 2.0
|
| 92 |
+
- _target_: sam3.train.loss.loss_fns.IABCEMdetr
|
| 93 |
+
weak_loss: False
|
| 94 |
+
weight_dict:
|
| 95 |
+
loss_ce: ${scratch.loss_ce_weight} # Change
|
| 96 |
+
presence_loss: ${scratch.presence_weight} # Change
|
| 97 |
+
pos_weight: ${scratch.iabce_pos_weight}
|
| 98 |
+
alpha: ${scratch.iabce_alpha}
|
| 99 |
+
gamma: 2
|
| 100 |
+
use_presence: True # Change
|
| 101 |
+
pos_focal: ${scratch.iabce_pos_focal}
|
| 102 |
+
pad_n_queries: ${scratch.num_queries}
|
| 103 |
+
pad_scale_pos: ${scratch.instance_query_loss_pad_scale_pos}
|
| 104 |
+
|
| 105 |
+
loss_fn_semantic_seg: null
|
| 106 |
+
scale_by_find_batch_size: ${scratch.scale_by_find_batch_size}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
# ============================================================================
|
| 110 |
+
# Different helper parameters and functions
|
| 111 |
+
# ============================================================================
|
| 112 |
+
scratch:
|
| 113 |
+
enable_segmentation: False
|
| 114 |
+
use_act_checkpoint_geo_encoder: True
|
| 115 |
+
input_geometry_encoder:
|
| 116 |
+
_target_: sam3.model.geometry_encoders.SequenceGeometryEncoder
|
| 117 |
+
pos_enc: ${scratch.pos_embed}
|
| 118 |
+
encode_boxes_as_points: False
|
| 119 |
+
points_direct_project: True
|
| 120 |
+
points_pool: True
|
| 121 |
+
points_pos_enc: True
|
| 122 |
+
boxes_direct_project: True
|
| 123 |
+
boxes_pool: True
|
| 124 |
+
boxes_pos_enc: True
|
| 125 |
+
d_model: ${scratch.d_model}
|
| 126 |
+
num_layers: 3
|
| 127 |
+
use_act_ckpt: ${scratch.use_act_checkpoint_geo_encoder}
|
| 128 |
+
layer:
|
| 129 |
+
_target_: sam3.model.encoder.TransformerEncoderLayer
|
| 130 |
+
activation: "relu"
|
| 131 |
+
d_model: ${scratch.d_model}
|
| 132 |
+
dim_feedforward: 2048
|
| 133 |
+
dropout: ${scratch.encoder_dropout}
|
| 134 |
+
pos_enc_at_attn: false
|
| 135 |
+
pre_norm: True
|
| 136 |
+
pos_enc_at_cross_attn_queries: false
|
| 137 |
+
pos_enc_at_cross_attn_keys: true
|
| 138 |
+
self_attention:
|
| 139 |
+
_target_: sam3.model.attention.MultiheadAttention
|
| 140 |
+
attn_type: Vanilla
|
| 141 |
+
num_heads: 8
|
| 142 |
+
dropout: ${scratch.encoder_dropout}
|
| 143 |
+
embed_dim: ${scratch.d_model}
|
| 144 |
+
batch_first: False
|
| 145 |
+
cross_attention:
|
| 146 |
+
_target_: sam3.model.attention.MultiheadAttention
|
| 147 |
+
attn_type: Vanilla
|
| 148 |
+
num_heads: 8
|
| 149 |
+
dropout: ${scratch.encoder_dropout}
|
| 150 |
+
embed_dim: ${scratch.d_model}
|
| 151 |
+
batch_first: False
|
| 152 |
+
add_cls: true
|
| 153 |
+
add_post_encode_proj: True
|
| 154 |
+
|
| 155 |
+
boxRPB: "log"
|
| 156 |
+
dac: True
|
| 157 |
+
use_early_fusion: true
|
| 158 |
+
o2m_mask: false
|
| 159 |
+
num_feature_levels: 1 # > 1 not implemented
|
| 160 |
+
encoder_dropout: 0.1
|
| 161 |
+
decoder_dropout: 0.1
|
| 162 |
+
|
| 163 |
+
tokenizer_ve:
|
| 164 |
+
_target_: sam3.model.tokenizer_ve.SimpleTokenizer
|
| 165 |
+
bpe_path: ${paths.bpe_path}
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
freeze_text_tower: False
|
| 169 |
+
freeze_image_tower: NoFreeze
|
| 170 |
+
vis_backbone_dp: 0.0
|
| 171 |
+
# Activation checkpointing (Save memory)
|
| 172 |
+
use_act_checkpoint_vision_backbone: True
|
| 173 |
+
use_act_checkpoint_text_backbone: True
|
| 174 |
+
use_act_checkpoint_encoder: True
|
| 175 |
+
use_act_checkpoint_decoder: True
|
| 176 |
+
|
| 177 |
+
loss: null
|
| 178 |
+
# Loss parameters
|
| 179 |
+
num_queries: 200
|
| 180 |
+
presence_weight: 20.0
|
| 181 |
+
loss_ce_weight: 20.0
|
| 182 |
+
iabce_pos_weight: 5.0
|
| 183 |
+
iabce_pos_focal: false
|
| 184 |
+
iabce_alpha: 0.25
|
| 185 |
+
instance_query_loss_pad_scale_pos: 1.0
|
| 186 |
+
use_o2m_matcher_on_o2m_aux: false
|
| 187 |
+
|
| 188 |
+
# Model parameters
|
| 189 |
+
use_instance_query: true
|
| 190 |
+
d_model: 256
|
| 191 |
+
pos_embed:
|
| 192 |
+
_target_: sam3.model.position_encoding.PositionEmbeddingSine
|
| 193 |
+
num_pos_feats: ${scratch.d_model}
|
| 194 |
+
normalize: true
|
| 195 |
+
scale: null
|
| 196 |
+
temperature: 10000
|
| 197 |
+
|
| 198 |
+
# Box processing
|
| 199 |
+
use_presence_eval: True
|
| 200 |
+
original_box_postprocessor:
|
| 201 |
+
_target_: sam3.eval.postprocessors.PostProcessImage
|
| 202 |
+
max_dets_per_img: -1 # infinite detections
|
| 203 |
+
use_original_ids: true
|
| 204 |
+
use_original_sizes_box: true
|
| 205 |
+
use_presence: ${scratch.use_presence_eval}
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
# Matcher configuration
|
| 209 |
+
matcher:
|
| 210 |
+
_target_: sam3.train.matcher.BinaryHungarianMatcherV2
|
| 211 |
+
focal: true
|
| 212 |
+
cost_class: 2.0
|
| 213 |
+
cost_bbox: 5.0
|
| 214 |
+
cost_giou: 2.0
|
| 215 |
+
alpha: 0.25
|
| 216 |
+
gamma: 2
|
| 217 |
+
stable: False
|
| 218 |
+
scale_by_find_batch_size: True
|
| 219 |
+
|
| 220 |
+
# Image processing parameters
|
| 221 |
+
resolution: 1008
|
| 222 |
+
consistent_transform: False
|
| 223 |
+
max_ann_per_img: 200
|
| 224 |
+
|
| 225 |
+
# Normalization parameters
|
| 226 |
+
train_norm_mean: [0.5, 0.5, 0.5]
|
| 227 |
+
train_norm_std: [0.5, 0.5, 0.5]
|
| 228 |
+
val_norm_mean: [0.5, 0.5, 0.5]
|
| 229 |
+
val_norm_std: [0.5, 0.5, 0.5]
|
| 230 |
+
|
| 231 |
+
# Training parameters
|
| 232 |
+
train_batch_size: 1
|
| 233 |
+
val_batch_size: 1
|
| 234 |
+
num_train_workers: 0
|
| 235 |
+
num_val_workers: 0
|
| 236 |
+
max_data_epochs: 40
|
| 237 |
+
target_epoch_size: 1500
|
| 238 |
+
hybrid_repeats: 1
|
| 239 |
+
context_length: 2
|
| 240 |
+
gather_pred_via_filesys: false
|
| 241 |
+
|
| 242 |
+
# Learning rate and scheduler parameters
|
| 243 |
+
lr_scale: 0.1
|
| 244 |
+
lr_transformer: ${times:8e-4,${scratch.lr_scale}}
|
| 245 |
+
lr_vision_backbone: ${times:2.5e-4,${scratch.lr_scale}}
|
| 246 |
+
lr_language_backbone: ${times:5e-5,${scratch.lr_scale}}
|
| 247 |
+
lrd_vision_backbone: 0.9
|
| 248 |
+
wd: 0.1
|
| 249 |
+
scheduler_timescale: 20
|
| 250 |
+
scheduler_warmup: 20
|
| 251 |
+
scheduler_cooldown: 20
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
# ============================================================================
|
| 257 |
+
# Trainer Configuration
|
| 258 |
+
# ============================================================================
|
| 259 |
+
|
| 260 |
+
trainer:
|
| 261 |
+
_target_: sam3.train.trainer.Trainer
|
| 262 |
+
skip_saving_ckpts: true
|
| 263 |
+
# _target_: sam3.train.trainer.Trainer
|
| 264 |
+
# skip_saving_ckpts: true
|
| 265 |
+
empty_gpu_mem_cache_after_eval: True
|
| 266 |
+
skip_first_val: True
|
| 267 |
+
max_epochs: ${scratch.max_data_epochs}
|
| 268 |
+
accelerator: cuda
|
| 269 |
+
seed_value: 123
|
| 270 |
+
val_epoch_freq: 10
|
| 271 |
+
mode: train
|
| 272 |
+
|
| 273 |
+
distributed:
|
| 274 |
+
backend: nccl
|
| 275 |
+
find_unused_parameters: True
|
| 276 |
+
gradient_as_bucket_view: True
|
| 277 |
+
|
| 278 |
+
loss:
|
| 279 |
+
all: ${odinw_train.loss}
|
| 280 |
+
default:
|
| 281 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 282 |
+
|
| 283 |
+
data:
|
| 284 |
+
train:
|
| 285 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 286 |
+
dataset:
|
| 287 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 288 |
+
limit_ids: ${odinw_train.num_images}
|
| 289 |
+
transforms: ${odinw_train.train_transforms}
|
| 290 |
+
load_segmentation: ${scratch.enable_segmentation}
|
| 291 |
+
max_ann_per_img: 500000
|
| 292 |
+
multiplier: 1
|
| 293 |
+
max_train_queries: 50000
|
| 294 |
+
max_val_queries: 50000
|
| 295 |
+
training: true
|
| 296 |
+
use_caching: False
|
| 297 |
+
img_folder: ${paths.odinw_data_root}/${odinw_train.supercategory_tuple.train.img_folder}
|
| 298 |
+
ann_file:
|
| 299 |
+
_target_: sam3.eval.coco_reindex.reindex_coco_to_temp
|
| 300 |
+
input_json_path: ${paths.odinw_data_root}/${odinw_train.supercategory_tuple.train.json}
|
| 301 |
+
coco_json_loader:
|
| 302 |
+
_target_: sam3.train.data.coco_json_loaders.COCO_FROM_JSON
|
| 303 |
+
prompts: ${odinw35_prompts.${odinw_train.supercategory_tuple.name}} #${odinw_train.supercategory_tuple.name)
|
| 304 |
+
_partial_: true
|
| 305 |
+
shuffle: True
|
| 306 |
+
batch_size: ${scratch.train_batch_size}
|
| 307 |
+
num_workers: ${scratch.num_train_workers}
|
| 308 |
+
pin_memory: False
|
| 309 |
+
drop_last: True
|
| 310 |
+
collate_fn:
|
| 311 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 312 |
+
_partial_: true
|
| 313 |
+
repeats: ${scratch.hybrid_repeats}
|
| 314 |
+
dict_key: all
|
| 315 |
+
with_seg_masks: ${scratch.enable_segmentation}
|
| 316 |
+
|
| 317 |
+
val:
|
| 318 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 319 |
+
dataset:
|
| 320 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 321 |
+
load_segmentation: ${scratch.enable_segmentation}
|
| 322 |
+
coco_json_loader:
|
| 323 |
+
_target_: sam3.train.data.coco_json_loaders.COCO_FROM_JSON
|
| 324 |
+
prompts: ${odinw35_prompts.${odinw_train.supercategory_tuple.name}}
|
| 325 |
+
include_negatives: true
|
| 326 |
+
category_chunk_size: 20 # Note: Since we are doing AP +ve we need to include all categories!
|
| 327 |
+
_partial_: true
|
| 328 |
+
img_folder: ${paths.odinw_data_root}/${odinw_train.supercategory_tuple.val.img_folder}
|
| 329 |
+
ann_file:
|
| 330 |
+
_target_: sam3.eval.coco_reindex.reindex_coco_to_temp
|
| 331 |
+
input_json_path: ${paths.odinw_data_root}/${odinw_train.supercategory_tuple.val.json}
|
| 332 |
+
transforms: ${odinw_train.val_transforms}
|
| 333 |
+
max_ann_per_img: 100000
|
| 334 |
+
multiplier: 1
|
| 335 |
+
training: false
|
| 336 |
+
|
| 337 |
+
shuffle: False
|
| 338 |
+
batch_size: ${scratch.val_batch_size}
|
| 339 |
+
num_workers: ${scratch.num_val_workers}
|
| 340 |
+
pin_memory: False
|
| 341 |
+
drop_last: False
|
| 342 |
+
collate_fn:
|
| 343 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 344 |
+
_partial_: true
|
| 345 |
+
repeats: 1
|
| 346 |
+
dict_key: odinw35
|
| 347 |
+
with_seg_masks: ${scratch.enable_segmentation}
|
| 348 |
+
|
| 349 |
+
model:
|
| 350 |
+
_target_: sam3.model_builder.build_sam3_image_model
|
| 351 |
+
bpe_path: ${paths.bpe_path}
|
| 352 |
+
device: cpus
|
| 353 |
+
eval_mode: false # Set to false if training
|
| 354 |
+
enable_segmentation: ${scratch.enable_segmentation} # Warning: Enable this if using segmentation.
|
| 355 |
+
|
| 356 |
+
meters:
|
| 357 |
+
val:
|
| 358 |
+
odinw35:
|
| 359 |
+
detection:
|
| 360 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 361 |
+
iou_type: "bbox"
|
| 362 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/odinw/${odinw_train.supercategory_tuple.name}
|
| 363 |
+
merge_predictions: True
|
| 364 |
+
postprocessor: ${scratch.original_box_postprocessor}
|
| 365 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 366 |
+
maxdets: 100
|
| 367 |
+
pred_file_evaluators:
|
| 368 |
+
- _target_: sam3.eval.coco_eval_offline.CocoEvaluatorOfflineWithPredFileEvaluators
|
| 369 |
+
gt_path:
|
| 370 |
+
_target_: sam3.eval.coco_reindex.reindex_coco_to_temp
|
| 371 |
+
input_json_path: ${paths.odinw_data_root}/${odinw_train.supercategory_tuple.val.json}
|
| 372 |
+
tide: False
|
| 373 |
+
iou_type: "bbox"
|
| 374 |
+
positive_split: False
|
| 375 |
+
|
| 376 |
+
optim:
|
| 377 |
+
amp:
|
| 378 |
+
enabled: True
|
| 379 |
+
amp_dtype: bfloat16
|
| 380 |
+
|
| 381 |
+
optimizer:
|
| 382 |
+
_target_: torch.optim.AdamW
|
| 383 |
+
|
| 384 |
+
gradient_clip:
|
| 385 |
+
_target_: sam3.train.optim.optimizer.GradientClipper
|
| 386 |
+
max_norm: 0.1
|
| 387 |
+
norm_type: 2
|
| 388 |
+
|
| 389 |
+
param_group_modifiers:
|
| 390 |
+
- _target_: sam3.train.optim.optimizer.layer_decay_param_modifier
|
| 391 |
+
_partial_: True
|
| 392 |
+
layer_decay_value: ${scratch.lrd_vision_backbone}
|
| 393 |
+
apply_to: 'backbone.vision_backbone.trunk'
|
| 394 |
+
overrides:
|
| 395 |
+
- pattern: '*pos_embed*'
|
| 396 |
+
value: 1.0
|
| 397 |
+
|
| 398 |
+
options:
|
| 399 |
+
lr:
|
| 400 |
+
- scheduler: # transformer and class_embed
|
| 401 |
+
_target_: sam3.train.optim.schedulers.InverseSquareRootParamScheduler
|
| 402 |
+
base_lr: ${scratch.lr_transformer}
|
| 403 |
+
timescale: ${scratch.scheduler_timescale}
|
| 404 |
+
warmup_steps: ${scratch.scheduler_warmup}
|
| 405 |
+
cooldown_steps: ${scratch.scheduler_cooldown}
|
| 406 |
+
- scheduler:
|
| 407 |
+
_target_: sam3.train.optim.schedulers.InverseSquareRootParamScheduler
|
| 408 |
+
base_lr: ${scratch.lr_vision_backbone}
|
| 409 |
+
timescale: ${scratch.scheduler_timescale}
|
| 410 |
+
warmup_steps: ${scratch.scheduler_warmup}
|
| 411 |
+
cooldown_steps: ${scratch.scheduler_cooldown}
|
| 412 |
+
param_names:
|
| 413 |
+
- 'backbone.vision_backbone.*'
|
| 414 |
+
- scheduler:
|
| 415 |
+
_target_: sam3.train.optim.schedulers.InverseSquareRootParamScheduler
|
| 416 |
+
base_lr: ${scratch.lr_language_backbone}
|
| 417 |
+
timescale: ${scratch.scheduler_timescale}
|
| 418 |
+
warmup_steps: ${scratch.scheduler_warmup}
|
| 419 |
+
cooldown_steps: ${scratch.scheduler_cooldown}
|
| 420 |
+
param_names:
|
| 421 |
+
- 'backbone.language_backbone.*'
|
| 422 |
+
|
| 423 |
+
weight_decay:
|
| 424 |
+
- scheduler:
|
| 425 |
+
_target_: fvcore.common.param_scheduler.ConstantParamScheduler
|
| 426 |
+
value: ${scratch.wd}
|
| 427 |
+
- scheduler:
|
| 428 |
+
_target_: fvcore.common.param_scheduler.ConstantParamScheduler
|
| 429 |
+
value: 0.0
|
| 430 |
+
param_names:
|
| 431 |
+
- '*bias*'
|
| 432 |
+
module_cls_names: ['torch.nn.LayerNorm']
|
| 433 |
+
|
| 434 |
+
checkpoint:
|
| 435 |
+
save_dir: ${launcher.experiment_log_dir}/checkpoints
|
| 436 |
+
save_freq: 0 # 0 only last checkpoint is saved.
|
| 437 |
+
|
| 438 |
+
|
| 439 |
+
logging:
|
| 440 |
+
tensorboard_writer:
|
| 441 |
+
_target_: sam3.train.utils.logger.make_tensorboard_logger
|
| 442 |
+
log_dir: ${launcher.experiment_log_dir}/tensorboard
|
| 443 |
+
flush_secs: 120
|
| 444 |
+
should_log: True
|
| 445 |
+
wandb_writer: null
|
| 446 |
+
log_dir: ${launcher.experiment_log_dir}/logs/${odinw_train.supercategory_tuple.name}
|
| 447 |
+
log_freq: 10
|
| 448 |
+
|
| 449 |
+
# ============================================================================
|
| 450 |
+
# Launcher and Submitit Configuration
|
| 451 |
+
# ============================================================================
|
| 452 |
+
|
| 453 |
+
launcher:
|
| 454 |
+
num_nodes: 1
|
| 455 |
+
gpus_per_node: 2
|
| 456 |
+
experiment_log_dir: null #${paths.experiment_log_dir}
|
| 457 |
+
multiprocessing_context: forkserver
|
| 458 |
+
|
| 459 |
+
submitit:
|
| 460 |
+
account: null
|
| 461 |
+
partition: null
|
| 462 |
+
qos: null
|
| 463 |
+
timeout_hour: 72
|
| 464 |
+
use_cluster: True
|
| 465 |
+
cpus_per_task: 10
|
| 466 |
+
port_range: [10000, 65000]
|
| 467 |
+
constraint: null
|
| 468 |
+
|
| 469 |
+
# task_index: 2
|
| 470 |
+
# Uncomment for job array configuration
|
| 471 |
+
job_array:
|
| 472 |
+
num_tasks: 13
|
| 473 |
+
task_index: 0
|
| 474 |
+
|
| 475 |
+
|
| 476 |
+
# ============================================================================
|
| 477 |
+
# ODinW13 Supercategories
|
| 478 |
+
# ============================================================================
|
| 479 |
+
|
| 480 |
+
all_odinw_supercategories:
|
| 481 |
+
- name: AerialMaritimeDrone_large
|
| 482 |
+
val:
|
| 483 |
+
img_folder: AerialMaritimeDrone/large/test/
|
| 484 |
+
json: AerialMaritimeDrone/large/test/annotations_without_background.json
|
| 485 |
+
train:
|
| 486 |
+
img_folder: AerialMaritimeDrone/large/train/
|
| 487 |
+
json: AerialMaritimeDrone/large/train/${odinw_train.train_file}.json
|
| 488 |
+
- name: Aquarium
|
| 489 |
+
val:
|
| 490 |
+
img_folder: Aquarium/Aquarium Combined.v2-raw-1024.coco/test/
|
| 491 |
+
json: Aquarium/Aquarium Combined.v2-raw-1024.coco/test/annotations_without_background.json
|
| 492 |
+
train:
|
| 493 |
+
img_folder: Aquarium/Aquarium Combined.v2-raw-1024.coco/train/
|
| 494 |
+
json: Aquarium/Aquarium Combined.v2-raw-1024.coco/train/${odinw_train.train_file}.json
|
| 495 |
+
- name: CottontailRabbits
|
| 496 |
+
val:
|
| 497 |
+
img_folder: CottontailRabbits/test/
|
| 498 |
+
json: CottontailRabbits/test/annotations_without_background.json
|
| 499 |
+
train:
|
| 500 |
+
img_folder: CottontailRabbits/train/
|
| 501 |
+
json: CottontailRabbits/train/${odinw_train.train_file}.json
|
| 502 |
+
- name: EgoHands_generic
|
| 503 |
+
val:
|
| 504 |
+
img_folder: EgoHands/generic/test/
|
| 505 |
+
json: EgoHands/generic/test/annotations_without_background.json
|
| 506 |
+
train:
|
| 507 |
+
img_folder: EgoHands/generic/train/
|
| 508 |
+
json: EgoHands/generic/train/${odinw_train.train_file}.json
|
| 509 |
+
- name: NorthAmericaMushrooms
|
| 510 |
+
val:
|
| 511 |
+
img_folder: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/test/
|
| 512 |
+
json: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/test/annotations_without_background.json
|
| 513 |
+
train:
|
| 514 |
+
img_folder: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/train/
|
| 515 |
+
json: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/train/${odinw_train.train_file}.json
|
| 516 |
+
- name: Packages
|
| 517 |
+
val:
|
| 518 |
+
img_folder: Packages/Raw/test/
|
| 519 |
+
json: Packages/Raw/test/annotations_without_background.json
|
| 520 |
+
train:
|
| 521 |
+
img_folder: Packages/Raw/train/
|
| 522 |
+
json: Packages/Raw/train/${odinw_train.train_file}.json
|
| 523 |
+
- name: PascalVOC
|
| 524 |
+
val:
|
| 525 |
+
img_folder: PascalVOC/valid/
|
| 526 |
+
json: PascalVOC/valid/annotations_without_background.json
|
| 527 |
+
train:
|
| 528 |
+
img_folder: PascalVOC/train/
|
| 529 |
+
json: PascalVOC/train/${odinw_train.train_file}.json
|
| 530 |
+
- name: Raccoon
|
| 531 |
+
val:
|
| 532 |
+
img_folder: Raccoon/Raccoon.v2-raw.coco/test/
|
| 533 |
+
json: Raccoon/Raccoon.v2-raw.coco/test/annotations_without_background.json
|
| 534 |
+
train:
|
| 535 |
+
img_folder: Raccoon/Raccoon.v2-raw.coco/train/
|
| 536 |
+
json: Raccoon/Raccoon.v2-raw.coco/train/${odinw_train.train_file}.json
|
| 537 |
+
- name: ShellfishOpenImages
|
| 538 |
+
val:
|
| 539 |
+
img_folder: ShellfishOpenImages/raw/test/
|
| 540 |
+
json: ShellfishOpenImages/raw/test/annotations_without_background.json
|
| 541 |
+
train:
|
| 542 |
+
img_folder: ShellfishOpenImages/raw/train/
|
| 543 |
+
json: ShellfishOpenImages/raw/train/${odinw_train.train_file}.json
|
| 544 |
+
- name: VehiclesOpenImages
|
| 545 |
+
val:
|
| 546 |
+
img_folder: VehiclesOpenImages/416x416/test/
|
| 547 |
+
json: VehiclesOpenImages/416x416/test/annotations_without_background.json
|
| 548 |
+
train:
|
| 549 |
+
img_folder: VehiclesOpenImages/416x416/train/
|
| 550 |
+
json: VehiclesOpenImages/416x416/train/${odinw_train.train_file}.json
|
| 551 |
+
- name: pistols
|
| 552 |
+
val:
|
| 553 |
+
img_folder: pistols/export/
|
| 554 |
+
json: pistols/export/test_annotations_without_background.json
|
| 555 |
+
train:
|
| 556 |
+
img_folder: pistols/export/
|
| 557 |
+
json: pistols/export/${odinw_train.train_file}.json
|
| 558 |
+
- name: pothole
|
| 559 |
+
val:
|
| 560 |
+
img_folder: pothole/test/
|
| 561 |
+
json: pothole/test/annotations_without_background.json
|
| 562 |
+
train:
|
| 563 |
+
img_folder: pothole/train/
|
| 564 |
+
json: pothole/train/${odinw_train.train_file}.json
|
| 565 |
+
- name: thermalDogsAndPeople
|
| 566 |
+
val:
|
| 567 |
+
img_folder: thermalDogsAndPeople/test/
|
| 568 |
+
json: thermalDogsAndPeople/test/annotations_without_background.json
|
| 569 |
+
train:
|
| 570 |
+
img_folder: thermalDogsAndPeople/train/
|
| 571 |
+
json: thermalDogsAndPeople/train/${odinw_train.train_file}.json
|
| 572 |
+
|
| 573 |
+
|
| 574 |
+
odinw35_prompts:
|
| 575 |
+
AerialMaritimeDrone_large: '[{"id": 1, "name": "boat", "supercategory": "movable-objects"},
|
| 576 |
+
{"id": 2, "name": "car", "supercategory": "movable-objects"}, {"id": 3, "name": "dock",
|
| 577 |
+
"supercategory": "movable-objects"}, {"id": 4, "name": "jet ski", "supercategory": "movable-objects"},
|
| 578 |
+
{"id": 5, "name": "boat lift", "supercategory": "movable-objects"}]'
|
| 579 |
+
Aquarium: null
|
| 580 |
+
CottontailRabbits: null
|
| 581 |
+
EgoHands_generic: null
|
| 582 |
+
NorthAmericaMushrooms: '[{''id'': 1, ''name'':
|
| 583 |
+
''chicken of the woods'', ''supercategory'': ''mushroom''}, {''id'': 2, ''name'': ''chanterelle'', ''supercategory'': ''mushroom''}]'
|
| 584 |
+
Packages: null
|
| 585 |
+
PascalVOC: null
|
| 586 |
+
Raccoon: null
|
| 587 |
+
ShellfishOpenImages: null
|
| 588 |
+
VehiclesOpenImages: null
|
| 589 |
+
pistols: null
|
| 590 |
+
pothole: null
|
| 591 |
+
thermalDogsAndPeople: null
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/odinw13/odinw_visual_only.yaml
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- _self_
|
| 4 |
+
|
| 5 |
+
# ============================================================================
|
| 6 |
+
# Paths Configuration (Chage this to your own paths)
|
| 7 |
+
# ============================================================================
|
| 8 |
+
# python sam3/train/train.py -c configs/odinw_text_only.yaml --use-cluster 1 --partition ${PARTITION} --account ${ACCOUNT} --qos ${QoS}
|
| 9 |
+
|
| 10 |
+
paths:
|
| 11 |
+
odinw_data_root: <YOUR_DATA_DIR>
|
| 12 |
+
experiment_log_dir: <YOUR EXPERIMENET LOG_DIR>
|
| 13 |
+
bpe_path: <BPE_PATH> # This should be under assets/bpe_simple_vocab_16e6.txt.gz
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
supercategory_tuple: ${all_odinw_supercategories.${string:${submitit.job_array.task_index}}}
|
| 17 |
+
# Validation transforms pipeline
|
| 18 |
+
val_transforms:
|
| 19 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 20 |
+
transforms:
|
| 21 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 22 |
+
sizes: ${scratch.resolution}
|
| 23 |
+
max_size:
|
| 24 |
+
_target_: sam3.train.transforms.basic.get_random_resize_max_size
|
| 25 |
+
size: ${scratch.resolution}
|
| 26 |
+
square: true
|
| 27 |
+
consistent_transform: False
|
| 28 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 29 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 30 |
+
mean: ${scratch.val_norm_mean}
|
| 31 |
+
std: ${scratch.val_norm_std}
|
| 32 |
+
- _target_: sam3.train.transforms.filter_query_transforms.TextQueryToVisual
|
| 33 |
+
keep_text_queries: false # Note: set this to false if you only want visual
|
| 34 |
+
probability: 1.0 # always
|
| 35 |
+
|
| 36 |
+
# ============================================================================
|
| 37 |
+
# Different helper parameters and functions
|
| 38 |
+
# ============================================================================
|
| 39 |
+
scratch:
|
| 40 |
+
enable_segmentation: True
|
| 41 |
+
# Box processing
|
| 42 |
+
use_presence_eval: True
|
| 43 |
+
original_box_postprocessor:
|
| 44 |
+
_target_: sam3.eval.postprocessors.PostProcessImage
|
| 45 |
+
max_dets_per_img: -1 # infinite detections
|
| 46 |
+
use_original_ids: true
|
| 47 |
+
use_original_sizes_box: true
|
| 48 |
+
use_presence: ${scratch.use_presence_eval}
|
| 49 |
+
|
| 50 |
+
# Image processing parameters
|
| 51 |
+
resolution: 1008
|
| 52 |
+
# Normalization parameters
|
| 53 |
+
val_norm_mean: [0.5, 0.5, 0.5]
|
| 54 |
+
val_norm_std: [0.5, 0.5, 0.5]
|
| 55 |
+
|
| 56 |
+
# Training parameters
|
| 57 |
+
val_batch_size: 2
|
| 58 |
+
num_val_workers: 0
|
| 59 |
+
gather_pred_via_filesys: false
|
| 60 |
+
|
| 61 |
+
# ============================================================================
|
| 62 |
+
# Trainer Configuration
|
| 63 |
+
# ============================================================================
|
| 64 |
+
|
| 65 |
+
trainer:
|
| 66 |
+
_target_: sam3.train.trainer.Trainer
|
| 67 |
+
skip_saving_ckpts: true
|
| 68 |
+
empty_gpu_mem_cache_after_eval: True
|
| 69 |
+
max_epochs: 1
|
| 70 |
+
accelerator: cuda
|
| 71 |
+
seed_value: 123
|
| 72 |
+
mode: val
|
| 73 |
+
|
| 74 |
+
distributed:
|
| 75 |
+
backend: nccl
|
| 76 |
+
find_unused_parameters: True
|
| 77 |
+
gradient_as_bucket_view: True
|
| 78 |
+
|
| 79 |
+
loss:
|
| 80 |
+
default:
|
| 81 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 82 |
+
|
| 83 |
+
data:
|
| 84 |
+
val:
|
| 85 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 86 |
+
dataset:
|
| 87 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 88 |
+
coco_json_loader:
|
| 89 |
+
_target_: sam3.train.data.coco_json_loaders.COCO_FROM_JSON
|
| 90 |
+
prompts: ${odinw35_prompts.${supercategory_tuple.name}}
|
| 91 |
+
include_negatives: true
|
| 92 |
+
category_chunk_size: 20 # Note: Since we are doing AP +ve we need to include all categories!
|
| 93 |
+
_partial_: true
|
| 94 |
+
img_folder: ${paths.odinw_data_root}/${supercategory_tuple.val.img_folder}
|
| 95 |
+
ann_file:
|
| 96 |
+
_target_: sam3.eval.coco_reindex.reindex_coco_to_temp
|
| 97 |
+
input_json_path: ${paths.odinw_data_root}/${supercategory_tuple.val.json}
|
| 98 |
+
transforms: ${val_transforms}
|
| 99 |
+
max_ann_per_img: 100000
|
| 100 |
+
multiplier: 1
|
| 101 |
+
training: false
|
| 102 |
+
|
| 103 |
+
shuffle: False
|
| 104 |
+
batch_size: ${scratch.val_batch_size}
|
| 105 |
+
num_workers: ${scratch.num_val_workers}
|
| 106 |
+
pin_memory: False
|
| 107 |
+
drop_last: False
|
| 108 |
+
collate_fn:
|
| 109 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 110 |
+
_partial_: true
|
| 111 |
+
repeats: 1
|
| 112 |
+
dict_key: odinw35
|
| 113 |
+
|
| 114 |
+
model:
|
| 115 |
+
_target_: sam3.model_builder.build_sam3_image_model
|
| 116 |
+
bpe_path: ${paths.bpe_path}
|
| 117 |
+
device: cpus
|
| 118 |
+
eval_mode: true # Set to false if training
|
| 119 |
+
enable_segmentation: ${scratch.enable_segmentation} # Warning: Enable this if using segmentation.
|
| 120 |
+
|
| 121 |
+
meters:
|
| 122 |
+
val:
|
| 123 |
+
odinw35:
|
| 124 |
+
detection:
|
| 125 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 126 |
+
iou_type: "bbox"
|
| 127 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/roboflow/${supercategory_tuple.name}
|
| 128 |
+
merge_predictions: True
|
| 129 |
+
postprocessor: ${scratch.original_box_postprocessor}
|
| 130 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 131 |
+
maxdets: 100
|
| 132 |
+
pred_file_evaluators:
|
| 133 |
+
- _target_: sam3.eval.coco_eval_offline.CocoEvaluatorOfflineWithPredFileEvaluators
|
| 134 |
+
gt_path:
|
| 135 |
+
_target_: sam3.eval.coco_reindex.reindex_coco_to_temp
|
| 136 |
+
input_json_path: ${paths.odinw_data_root}/${supercategory_tuple.val.json}
|
| 137 |
+
tide: False
|
| 138 |
+
iou_type: "bbox"
|
| 139 |
+
positive_split: true
|
| 140 |
+
|
| 141 |
+
checkpoint:
|
| 142 |
+
save_dir: ${launcher.experiment_log_dir}/checkpoints
|
| 143 |
+
save_freq: 0 # 0 only last checkpoint is saved.
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
logging:
|
| 147 |
+
tensorboard_writer:
|
| 148 |
+
_target_: sam3.train.utils.logger.make_tensorboard_logger
|
| 149 |
+
log_dir: ${launcher.experiment_log_dir}/tensorboard
|
| 150 |
+
flush_secs: 120
|
| 151 |
+
should_log: True
|
| 152 |
+
wandb_writer: null
|
| 153 |
+
log_dir: ${launcher.experiment_log_dir}/logs/${supercategory_tuple.name}
|
| 154 |
+
log_freq: 10
|
| 155 |
+
|
| 156 |
+
# ============================================================================
|
| 157 |
+
# Launcher and Submitit Configuration
|
| 158 |
+
# ============================================================================
|
| 159 |
+
|
| 160 |
+
launcher:
|
| 161 |
+
num_nodes: 1
|
| 162 |
+
gpus_per_node: 2
|
| 163 |
+
experiment_log_dir: ${paths.experiment_log_dir}
|
| 164 |
+
multiprocessing_context: forkserver
|
| 165 |
+
|
| 166 |
+
submitit:
|
| 167 |
+
account: null
|
| 168 |
+
partition: null
|
| 169 |
+
qos: null
|
| 170 |
+
timeout_hour: 72
|
| 171 |
+
use_cluster: True
|
| 172 |
+
cpus_per_task: 10
|
| 173 |
+
port_range: [10000, 65000]
|
| 174 |
+
constraint: null
|
| 175 |
+
|
| 176 |
+
job_array:
|
| 177 |
+
num_tasks: 13
|
| 178 |
+
task_index: 0
|
| 179 |
+
|
| 180 |
+
# ============================================================================
|
| 181 |
+
# ODinW13 Supercategories
|
| 182 |
+
# ============================================================================
|
| 183 |
+
|
| 184 |
+
all_odinw_supercategories:
|
| 185 |
+
- name: AerialMaritimeDrone_large
|
| 186 |
+
val:
|
| 187 |
+
img_folder: AerialMaritimeDrone/large/test/
|
| 188 |
+
json: AerialMaritimeDrone/large/test/annotations_without_background.json
|
| 189 |
+
- name: Aquarium
|
| 190 |
+
val:
|
| 191 |
+
img_folder: Aquarium/Aquarium Combined.v2-raw-1024.coco/test/
|
| 192 |
+
json: Aquarium/Aquarium Combined.v2-raw-1024.coco/test/annotations_without_background.json
|
| 193 |
+
- name: CottontailRabbits
|
| 194 |
+
val:
|
| 195 |
+
img_folder: CottontailRabbits/test/
|
| 196 |
+
json: CottontailRabbits/test/annotations_without_background.json
|
| 197 |
+
- name: EgoHands_generic
|
| 198 |
+
val:
|
| 199 |
+
img_folder: EgoHands/generic/test/
|
| 200 |
+
json: EgoHands/generic/test/annotations_without_background.json
|
| 201 |
+
- name: NorthAmericaMushrooms
|
| 202 |
+
val:
|
| 203 |
+
img_folder: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/test/
|
| 204 |
+
json: NorthAmericaMushrooms/North American Mushrooms.v1-416x416.coco/test/annotations_without_background.json
|
| 205 |
+
- name: Packages
|
| 206 |
+
val:
|
| 207 |
+
img_folder: Packages/Raw/test/
|
| 208 |
+
json: Packages/Raw/test/annotations_without_background.json
|
| 209 |
+
- name: PascalVOC
|
| 210 |
+
val:
|
| 211 |
+
img_folder: PascalVOC/valid/
|
| 212 |
+
json: PascalVOC/valid/annotations_without_background.json
|
| 213 |
+
- name: Raccoon
|
| 214 |
+
val:
|
| 215 |
+
img_folder: Raccoon/Raccoon.v2-raw.coco/test/
|
| 216 |
+
json: Raccoon/Raccoon.v2-raw.coco/test/annotations_without_background.json
|
| 217 |
+
- name: ShellfishOpenImages
|
| 218 |
+
val:
|
| 219 |
+
img_folder: ShellfishOpenImages/raw/test/
|
| 220 |
+
json: ShellfishOpenImages/raw/test/annotations_without_background.json
|
| 221 |
+
- name: VehiclesOpenImages
|
| 222 |
+
val:
|
| 223 |
+
img_folder: VehiclesOpenImages/416x416/test/
|
| 224 |
+
json: VehiclesOpenImages/416x416/test/annotations_without_background.json
|
| 225 |
+
- name: pistols
|
| 226 |
+
val:
|
| 227 |
+
img_folder: pistols/export/
|
| 228 |
+
json: pistols/export/test_annotations_without_background.json
|
| 229 |
+
- name: pothole
|
| 230 |
+
val:
|
| 231 |
+
img_folder: pothole/test/
|
| 232 |
+
json: pothole/test/annotations_without_background.json
|
| 233 |
+
- name: thermalDogsAndPeople
|
| 234 |
+
val:
|
| 235 |
+
img_folder: thermalDogsAndPeople/test/
|
| 236 |
+
json: thermalDogsAndPeople/test/annotations_without_background.json
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
odinw35_prompts:
|
| 240 |
+
AerialMaritimeDrone_large: '[{"id": 1, "name": "boat", "supercategory": "movable-objects"},
|
| 241 |
+
{"id": 2, "name": "car", "supercategory": "movable-objects"}, {"id": 3, "name": "dock",
|
| 242 |
+
"supercategory": "movable-objects"}, {"id": 4, "name": "jet ski", "supercategory": "movable-objects"},
|
| 243 |
+
{"id": 5, "name": "boat lift", "supercategory": "movable-objects"}]'
|
| 244 |
+
Aquarium: null
|
| 245 |
+
CottontailRabbits: null
|
| 246 |
+
EgoHands_generic: null
|
| 247 |
+
NorthAmericaMushrooms: '[{''id'': 1, ''name'':
|
| 248 |
+
''chicken of the woods'', ''supercategory'': ''mushroom''}, {''id'': 2, ''name'': ''chanterelle'', ''supercategory'': ''mushroom''}]'
|
| 249 |
+
Packages: null
|
| 250 |
+
PascalVOC: null
|
| 251 |
+
Raccoon: null
|
| 252 |
+
ShellfishOpenImages: null
|
| 253 |
+
VehiclesOpenImages: null
|
| 254 |
+
pistols: null
|
| 255 |
+
pothole: null
|
| 256 |
+
thermalDogsAndPeople: null
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/roboflow_v100/roboflow_v100_eval.yaml
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- _self_
|
| 4 |
+
|
| 5 |
+
# ============================================================================
|
| 6 |
+
# Paths Configuration (Chage this to your own paths)
|
| 7 |
+
# ============================================================================
|
| 8 |
+
paths:
|
| 9 |
+
roboflow_vl_100_root: <YOUR_DATASET_DIR>
|
| 10 |
+
experiment_log_dir: <YOUR EXPERIMENET LOG_DIR>
|
| 11 |
+
bpe_path: <BPE_PATH> # This should be under assets/bpe_simple_vocab_16e6.txt.gz
|
| 12 |
+
|
| 13 |
+
# Roboflow dataset configuration
|
| 14 |
+
roboflow_train:
|
| 15 |
+
num_images: 100 # Note: This is the number of images used for training. If null, all images are used.
|
| 16 |
+
supercategory: ${all_roboflow_supercategories.${string:${submitit.job_array.task_index}}}
|
| 17 |
+
|
| 18 |
+
# Training transforms pipeline
|
| 19 |
+
train_transforms:
|
| 20 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 21 |
+
transforms:
|
| 22 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 23 |
+
query_filter:
|
| 24 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterCrowds
|
| 25 |
+
- _target_: sam3.train.transforms.point_sampling.RandomizeInputBbox
|
| 26 |
+
box_noise_std: 0.1
|
| 27 |
+
box_noise_max: 20
|
| 28 |
+
- _target_: sam3.train.transforms.segmentation.DecodeRle
|
| 29 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 30 |
+
sizes:
|
| 31 |
+
_target_: sam3.train.transforms.basic.get_random_resize_scales
|
| 32 |
+
size: ${scratch.resolution}
|
| 33 |
+
min_size: 480
|
| 34 |
+
rounded: false
|
| 35 |
+
max_size:
|
| 36 |
+
_target_: sam3.train.transforms.basic.get_random_resize_max_size
|
| 37 |
+
size: ${scratch.resolution}
|
| 38 |
+
square: true
|
| 39 |
+
consistent_transform: ${scratch.consistent_transform}
|
| 40 |
+
- _target_: sam3.train.transforms.basic_for_api.PadToSizeAPI
|
| 41 |
+
size: ${scratch.resolution}
|
| 42 |
+
consistent_transform: ${scratch.consistent_transform}
|
| 43 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 44 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 45 |
+
query_filter:
|
| 46 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterEmptyTargets
|
| 47 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 48 |
+
mean: ${scratch.train_norm_mean}
|
| 49 |
+
std: ${scratch.train_norm_std}
|
| 50 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 51 |
+
query_filter:
|
| 52 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterEmptyTargets
|
| 53 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 54 |
+
query_filter:
|
| 55 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterFindQueriesWithTooManyOut
|
| 56 |
+
max_num_objects: ${scratch.max_ann_per_img}
|
| 57 |
+
|
| 58 |
+
# Validation transforms pipeline
|
| 59 |
+
val_transforms:
|
| 60 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 61 |
+
transforms:
|
| 62 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 63 |
+
sizes: ${scratch.resolution}
|
| 64 |
+
max_size:
|
| 65 |
+
_target_: sam3.train.transforms.basic.get_random_resize_max_size
|
| 66 |
+
size: ${scratch.resolution}
|
| 67 |
+
square: true
|
| 68 |
+
consistent_transform: False
|
| 69 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 70 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 71 |
+
mean: ${scratch.train_norm_mean}
|
| 72 |
+
std: ${scratch.train_norm_std}
|
| 73 |
+
|
| 74 |
+
# loss config (no mask loss)
|
| 75 |
+
loss:
|
| 76 |
+
_target_: sam3.train.loss.sam3_loss.Sam3LossWrapper
|
| 77 |
+
matcher: ${scratch.matcher}
|
| 78 |
+
o2m_weight: 2.0
|
| 79 |
+
o2m_matcher:
|
| 80 |
+
_target_: sam3.train.matcher.BinaryOneToManyMatcher
|
| 81 |
+
alpha: 0.3
|
| 82 |
+
threshold: 0.4
|
| 83 |
+
topk: 4
|
| 84 |
+
use_o2m_matcher_on_o2m_aux: false # Another option is true
|
| 85 |
+
loss_fns_find:
|
| 86 |
+
- _target_: sam3.train.loss.loss_fns.Boxes
|
| 87 |
+
weight_dict:
|
| 88 |
+
loss_bbox: 5.0
|
| 89 |
+
loss_giou: 2.0
|
| 90 |
+
- _target_: sam3.train.loss.loss_fns.IABCEMdetr
|
| 91 |
+
weak_loss: False
|
| 92 |
+
weight_dict:
|
| 93 |
+
loss_ce: 20.0 # Another option is 100.0
|
| 94 |
+
presence_loss: 20.0
|
| 95 |
+
pos_weight: 10.0 # Another option is 5.0
|
| 96 |
+
alpha: 0.25
|
| 97 |
+
gamma: 2
|
| 98 |
+
use_presence: True # Change
|
| 99 |
+
pos_focal: false
|
| 100 |
+
pad_n_queries: 200
|
| 101 |
+
pad_scale_pos: 1.0
|
| 102 |
+
|
| 103 |
+
loss_fn_semantic_seg: null
|
| 104 |
+
scale_by_find_batch_size: ${scratch.scale_by_find_batch_size}
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
# NOTE: Loss to be used for training in case of segmentation
|
| 108 |
+
# loss:
|
| 109 |
+
# _target_: sam3.train.loss.sam3_loss.Sam3LossWrapper
|
| 110 |
+
# matcher: ${scratch.matcher}
|
| 111 |
+
# o2m_weight: 2.0
|
| 112 |
+
# o2m_matcher:
|
| 113 |
+
# _target_: sam3.train.matcher.BinaryOneToManyMatcher
|
| 114 |
+
# alpha: 0.3
|
| 115 |
+
# threshold: 0.4
|
| 116 |
+
# topk: 4
|
| 117 |
+
# use_o2m_matcher_on_o2m_aux: false
|
| 118 |
+
# loss_fns_find:
|
| 119 |
+
# - _target_: sam3.train.loss.loss_fns.Boxes
|
| 120 |
+
# weight_dict:
|
| 121 |
+
# loss_bbox: 5.0
|
| 122 |
+
# loss_giou: 2.0
|
| 123 |
+
# - _target_: sam3.train.loss.loss_fns.IABCEMdetr
|
| 124 |
+
# weak_loss: False
|
| 125 |
+
# weight_dict:
|
| 126 |
+
# loss_ce: 20.0 # Another option is 100.0
|
| 127 |
+
# presence_loss: 20.0
|
| 128 |
+
# pos_weight: 10.0 # Another option is 5.0
|
| 129 |
+
# alpha: 0.25
|
| 130 |
+
# gamma: 2
|
| 131 |
+
# use_presence: True # Change
|
| 132 |
+
# pos_focal: false
|
| 133 |
+
# pad_n_queries: 200
|
| 134 |
+
# pad_scale_pos: 1.0
|
| 135 |
+
# - _target_: sam3.train.loss.loss_fns.Masks
|
| 136 |
+
# focal_alpha: 0.25
|
| 137 |
+
# focal_gamma: 2.0
|
| 138 |
+
# weight_dict:
|
| 139 |
+
# loss_mask: 200.0
|
| 140 |
+
# loss_dice: 10.0
|
| 141 |
+
# compute_aux: false
|
| 142 |
+
# loss_fn_semantic_seg:
|
| 143 |
+
# _target_: sam3.losses.loss_fns.SemanticSegCriterion
|
| 144 |
+
# presence_head: True
|
| 145 |
+
# presence_loss: False # Change
|
| 146 |
+
# focal: True
|
| 147 |
+
# focal_alpha: 0.6
|
| 148 |
+
# focal_gamma: 2.0
|
| 149 |
+
# downsample: False
|
| 150 |
+
# weight_dict:
|
| 151 |
+
# loss_semantic_seg: 20.0
|
| 152 |
+
# loss_semantic_presence: 1.0
|
| 153 |
+
# loss_semantic_dice: 30.0
|
| 154 |
+
# scale_by_find_batch_size: ${scratch.scale_by_find_batch_size}
|
| 155 |
+
|
| 156 |
+
# ============================================================================
|
| 157 |
+
# Different helper parameters and functions
|
| 158 |
+
# ============================================================================
|
| 159 |
+
scratch:
|
| 160 |
+
enable_segmentation: False # NOTE: This is the number of queries used for segmentation
|
| 161 |
+
# Model parameters
|
| 162 |
+
d_model: 256
|
| 163 |
+
pos_embed:
|
| 164 |
+
_target_: sam3.model.position_encoding.PositionEmbeddingSine
|
| 165 |
+
num_pos_feats: ${scratch.d_model}
|
| 166 |
+
normalize: true
|
| 167 |
+
scale: null
|
| 168 |
+
temperature: 10000
|
| 169 |
+
|
| 170 |
+
# Box processing
|
| 171 |
+
use_presence_eval: True
|
| 172 |
+
original_box_postprocessor:
|
| 173 |
+
_target_: sam3.eval.postprocessors.PostProcessImage
|
| 174 |
+
max_dets_per_img: -1 # infinite detections
|
| 175 |
+
use_original_ids: true
|
| 176 |
+
use_original_sizes_box: true
|
| 177 |
+
use_presence: ${scratch.use_presence_eval}
|
| 178 |
+
|
| 179 |
+
# Matcher configuration
|
| 180 |
+
matcher:
|
| 181 |
+
_target_: sam3.train.matcher.BinaryHungarianMatcherV2
|
| 182 |
+
focal: true # with `focal: true` it is equivalent to BinaryFocalHungarianMatcher
|
| 183 |
+
cost_class: 2.0
|
| 184 |
+
cost_bbox: 5.0
|
| 185 |
+
cost_giou: 2.0
|
| 186 |
+
alpha: 0.25
|
| 187 |
+
gamma: 2
|
| 188 |
+
stable: False
|
| 189 |
+
scale_by_find_batch_size: True
|
| 190 |
+
|
| 191 |
+
# Image processing parameters
|
| 192 |
+
resolution: 1008
|
| 193 |
+
consistent_transform: False
|
| 194 |
+
max_ann_per_img: 200
|
| 195 |
+
|
| 196 |
+
# Normalization parameters
|
| 197 |
+
train_norm_mean: [0.5, 0.5, 0.5]
|
| 198 |
+
train_norm_std: [0.5, 0.5, 0.5]
|
| 199 |
+
val_norm_mean: [0.5, 0.5, 0.5]
|
| 200 |
+
val_norm_std: [0.5, 0.5, 0.5]
|
| 201 |
+
|
| 202 |
+
# Training parameters
|
| 203 |
+
num_train_workers: 10
|
| 204 |
+
num_val_workers: 0
|
| 205 |
+
max_data_epochs: 20
|
| 206 |
+
target_epoch_size: 1500
|
| 207 |
+
hybrid_repeats: 1
|
| 208 |
+
context_length: 2
|
| 209 |
+
gather_pred_via_filesys: false
|
| 210 |
+
|
| 211 |
+
# Learning rate and scheduler parameters
|
| 212 |
+
lr_scale: 0.1
|
| 213 |
+
lr_transformer: ${times:8e-4,${scratch.lr_scale}}
|
| 214 |
+
lr_vision_backbone: ${times:2.5e-4,${scratch.lr_scale}}
|
| 215 |
+
lr_language_backbone: ${times:5e-5,${scratch.lr_scale}}
|
| 216 |
+
lrd_vision_backbone: 0.9
|
| 217 |
+
wd: 0.1
|
| 218 |
+
scheduler_timescale: 20
|
| 219 |
+
scheduler_warmup: 20
|
| 220 |
+
scheduler_cooldown: 20
|
| 221 |
+
|
| 222 |
+
val_batch_size: 1
|
| 223 |
+
collate_fn_val:
|
| 224 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 225 |
+
_partial_: true
|
| 226 |
+
repeats: ${scratch.hybrid_repeats}
|
| 227 |
+
dict_key: roboflow100
|
| 228 |
+
with_seg_masks: ${scratch.enable_segmentation} # Note: Set this to true if using segmentation masks!
|
| 229 |
+
|
| 230 |
+
gradient_accumulation_steps: 1
|
| 231 |
+
train_batch_size: 1
|
| 232 |
+
collate_fn:
|
| 233 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 234 |
+
_partial_: true
|
| 235 |
+
repeats: ${scratch.hybrid_repeats}
|
| 236 |
+
dict_key: all
|
| 237 |
+
with_seg_masks: ${scratch.enable_segmentation} # Note: Set this to true if using segmentation masks!
|
| 238 |
+
|
| 239 |
+
# ============================================================================
|
| 240 |
+
# Trainer Configuration
|
| 241 |
+
# ============================================================================
|
| 242 |
+
|
| 243 |
+
trainer:
|
| 244 |
+
|
| 245 |
+
_target_: sam3.train.trainer.Trainer
|
| 246 |
+
skip_saving_ckpts: true
|
| 247 |
+
empty_gpu_mem_cache_after_eval: True
|
| 248 |
+
skip_first_val: True
|
| 249 |
+
max_epochs: 20
|
| 250 |
+
accelerator: cuda
|
| 251 |
+
seed_value: 123
|
| 252 |
+
val_epoch_freq: 10
|
| 253 |
+
mode: val
|
| 254 |
+
gradient_accumulation_steps: ${scratch.gradient_accumulation_steps}
|
| 255 |
+
|
| 256 |
+
distributed:
|
| 257 |
+
backend: nccl
|
| 258 |
+
find_unused_parameters: True
|
| 259 |
+
gradient_as_bucket_view: True
|
| 260 |
+
|
| 261 |
+
loss:
|
| 262 |
+
all: ${roboflow_train.loss}
|
| 263 |
+
default:
|
| 264 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 265 |
+
|
| 266 |
+
data:
|
| 267 |
+
train:
|
| 268 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 269 |
+
dataset:
|
| 270 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 271 |
+
limit_ids: ${roboflow_train.num_images}
|
| 272 |
+
transforms: ${roboflow_train.train_transforms}
|
| 273 |
+
load_segmentation: ${scratch.enable_segmentation}
|
| 274 |
+
max_ann_per_img: 500000
|
| 275 |
+
multiplier: 1
|
| 276 |
+
max_train_queries: 50000
|
| 277 |
+
max_val_queries: 50000
|
| 278 |
+
training: true
|
| 279 |
+
use_caching: False
|
| 280 |
+
img_folder: ${paths.roboflow_vl_100_root}/${roboflow_train.supercategory}/train/
|
| 281 |
+
ann_file: ${paths.roboflow_vl_100_root}/${roboflow_train.supercategory}/train/_annotations.coco.json
|
| 282 |
+
|
| 283 |
+
shuffle: True
|
| 284 |
+
batch_size: ${scratch.train_batch_size}
|
| 285 |
+
num_workers: ${scratch.num_train_workers}
|
| 286 |
+
pin_memory: True
|
| 287 |
+
drop_last: True
|
| 288 |
+
collate_fn: ${scratch.collate_fn}
|
| 289 |
+
|
| 290 |
+
val:
|
| 291 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 292 |
+
dataset:
|
| 293 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 294 |
+
load_segmentation: ${scratch.enable_segmentation}
|
| 295 |
+
coco_json_loader:
|
| 296 |
+
_target_: sam3.train.data.coco_json_loaders.COCO_FROM_JSON
|
| 297 |
+
include_negatives: true
|
| 298 |
+
category_chunk_size: 2 # Note: You can increase this based on the memory of your GPU.
|
| 299 |
+
_partial_: true
|
| 300 |
+
img_folder: ${paths.roboflow_vl_100_root}/${roboflow_train.supercategory}/test/
|
| 301 |
+
ann_file: ${paths.roboflow_vl_100_root}/${roboflow_train.supercategory}/test/_annotations.coco.json
|
| 302 |
+
transforms: ${roboflow_train.val_transforms}
|
| 303 |
+
max_ann_per_img: 100000
|
| 304 |
+
multiplier: 1
|
| 305 |
+
training: false
|
| 306 |
+
|
| 307 |
+
shuffle: False
|
| 308 |
+
batch_size: ${scratch.val_batch_size}
|
| 309 |
+
num_workers: ${scratch.num_val_workers}
|
| 310 |
+
pin_memory: True
|
| 311 |
+
drop_last: False
|
| 312 |
+
collate_fn: ${scratch.collate_fn_val}
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
model:
|
| 316 |
+
_target_: sam3.model_builder.build_sam3_image_model
|
| 317 |
+
bpe_path: ${paths.bpe_path}
|
| 318 |
+
device: cpus
|
| 319 |
+
eval_mode: true
|
| 320 |
+
enable_segmentation: ${scratch.enable_segmentation} # Warning: Enable this if using segmentation.
|
| 321 |
+
|
| 322 |
+
meters:
|
| 323 |
+
val:
|
| 324 |
+
roboflow100:
|
| 325 |
+
detection:
|
| 326 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 327 |
+
iou_type: "bbox"
|
| 328 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/roboflow/${roboflow_train.supercategory}
|
| 329 |
+
merge_predictions: True
|
| 330 |
+
postprocessor: ${scratch.original_box_postprocessor}
|
| 331 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 332 |
+
maxdets: 100
|
| 333 |
+
pred_file_evaluators:
|
| 334 |
+
- _target_: sam3.eval.coco_eval_offline.CocoEvaluatorOfflineWithPredFileEvaluators
|
| 335 |
+
gt_path: ${paths.roboflow_vl_100_root}/${roboflow_train.supercategory}/test/_annotations.coco.json
|
| 336 |
+
tide: False
|
| 337 |
+
iou_type: "bbox"
|
| 338 |
+
|
| 339 |
+
optim:
|
| 340 |
+
amp:
|
| 341 |
+
enabled: True
|
| 342 |
+
amp_dtype: bfloat16
|
| 343 |
+
|
| 344 |
+
optimizer:
|
| 345 |
+
_target_: torch.optim.AdamW
|
| 346 |
+
|
| 347 |
+
gradient_clip:
|
| 348 |
+
_target_: sam3.train.optim.optimizer.GradientClipper
|
| 349 |
+
max_norm: 0.1
|
| 350 |
+
norm_type: 2
|
| 351 |
+
|
| 352 |
+
param_group_modifiers:
|
| 353 |
+
- _target_: sam3.train.optim.optimizer.layer_decay_param_modifier
|
| 354 |
+
_partial_: True
|
| 355 |
+
layer_decay_value: ${scratch.lrd_vision_backbone}
|
| 356 |
+
apply_to: 'backbone.vision_backbone.trunk'
|
| 357 |
+
overrides:
|
| 358 |
+
- pattern: '*pos_embed*'
|
| 359 |
+
value: 1.0
|
| 360 |
+
|
| 361 |
+
options:
|
| 362 |
+
lr:
|
| 363 |
+
- scheduler: # transformer and class_embed
|
| 364 |
+
_target_: sam3.train.optim.schedulers.InverseSquareRootParamScheduler
|
| 365 |
+
base_lr: ${scratch.lr_transformer}
|
| 366 |
+
timescale: ${scratch.scheduler_timescale}
|
| 367 |
+
warmup_steps: ${scratch.scheduler_warmup}
|
| 368 |
+
cooldown_steps: ${scratch.scheduler_cooldown}
|
| 369 |
+
- scheduler:
|
| 370 |
+
_target_: sam3.train.optim.schedulers.InverseSquareRootParamScheduler
|
| 371 |
+
base_lr: ${scratch.lr_vision_backbone}
|
| 372 |
+
timescale: ${scratch.scheduler_timescale}
|
| 373 |
+
warmup_steps: ${scratch.scheduler_warmup}
|
| 374 |
+
cooldown_steps: ${scratch.scheduler_cooldown}
|
| 375 |
+
param_names:
|
| 376 |
+
- 'backbone.vision_backbone.*'
|
| 377 |
+
- scheduler:
|
| 378 |
+
_target_: sam3.train.optim.schedulers.InverseSquareRootParamScheduler
|
| 379 |
+
base_lr: ${scratch.lr_language_backbone}
|
| 380 |
+
timescale: ${scratch.scheduler_timescale}
|
| 381 |
+
warmup_steps: ${scratch.scheduler_warmup}
|
| 382 |
+
cooldown_steps: ${scratch.scheduler_cooldown}
|
| 383 |
+
param_names:
|
| 384 |
+
- 'backbone.language_backbone.*'
|
| 385 |
+
|
| 386 |
+
weight_decay:
|
| 387 |
+
- scheduler:
|
| 388 |
+
_target_: fvcore.common.param_scheduler.ConstantParamScheduler
|
| 389 |
+
value: ${scratch.wd}
|
| 390 |
+
- scheduler:
|
| 391 |
+
_target_: fvcore.common.param_scheduler.ConstantParamScheduler
|
| 392 |
+
value: 0.0
|
| 393 |
+
param_names:
|
| 394 |
+
- '*bias*'
|
| 395 |
+
module_cls_names: ['torch.nn.LayerNorm']
|
| 396 |
+
|
| 397 |
+
checkpoint:
|
| 398 |
+
save_dir: ${launcher.experiment_log_dir}/checkpoints
|
| 399 |
+
save_freq: 0 # 0 only last checkpoint is saved.
|
| 400 |
+
|
| 401 |
+
logging:
|
| 402 |
+
tensorboard_writer:
|
| 403 |
+
_target_: sam3.train.utils.logger.make_tensorboard_logger
|
| 404 |
+
log_dir: ${launcher.experiment_log_dir}/tensorboard
|
| 405 |
+
flush_secs: 120
|
| 406 |
+
should_log: True
|
| 407 |
+
wandb_writer: null
|
| 408 |
+
log_dir: ${launcher.experiment_log_dir}/logs/${roboflow_train.supercategory}
|
| 409 |
+
log_freq: 10
|
| 410 |
+
|
| 411 |
+
# ============================================================================
|
| 412 |
+
# Launcher and Submitit Configuration
|
| 413 |
+
# ============================================================================
|
| 414 |
+
|
| 415 |
+
launcher:
|
| 416 |
+
num_nodes: 1
|
| 417 |
+
gpus_per_node: 2
|
| 418 |
+
experiment_log_dir: ${paths.experiment_log_dir}
|
| 419 |
+
multiprocessing_context: forkserver
|
| 420 |
+
|
| 421 |
+
submitit:
|
| 422 |
+
account: null
|
| 423 |
+
partition: null
|
| 424 |
+
qos: null
|
| 425 |
+
timeout_hour: 72
|
| 426 |
+
use_cluster: True
|
| 427 |
+
cpus_per_task: 10
|
| 428 |
+
port_range: [10000, 65000]
|
| 429 |
+
constraint: null
|
| 430 |
+
# Uncomment for job array configuration
|
| 431 |
+
job_array:
|
| 432 |
+
num_tasks: 100
|
| 433 |
+
task_index: 0
|
| 434 |
+
|
| 435 |
+
# ============================================================================
|
| 436 |
+
# Available Roboflow Supercategories (for reference)
|
| 437 |
+
# ============================================================================
|
| 438 |
+
|
| 439 |
+
all_roboflow_supercategories:
|
| 440 |
+
- -grccs
|
| 441 |
+
- zebrasatasturias
|
| 442 |
+
- cod-mw-warzone
|
| 443 |
+
- canalstenosis
|
| 444 |
+
- label-printing-defect-version-2
|
| 445 |
+
- new-defects-in-wood
|
| 446 |
+
- orionproducts
|
| 447 |
+
- aquarium-combined
|
| 448 |
+
- varroa-mites-detection--test-set
|
| 449 |
+
- clashroyalechardetector
|
| 450 |
+
- stomata-cells
|
| 451 |
+
- halo-infinite-angel-videogame
|
| 452 |
+
- pig-detection
|
| 453 |
+
- urine-analysis1
|
| 454 |
+
- aerial-sheep
|
| 455 |
+
- orgharvest
|
| 456 |
+
- actions
|
| 457 |
+
- mahjong
|
| 458 |
+
- liver-disease
|
| 459 |
+
- needle-base-tip-min-max
|
| 460 |
+
- wheel-defect-detection
|
| 461 |
+
- aircraft-turnaround-dataset
|
| 462 |
+
- xray
|
| 463 |
+
- wildfire-smoke
|
| 464 |
+
- spinefrxnormalvindr
|
| 465 |
+
- ufba-425
|
| 466 |
+
- speech-bubbles-detection
|
| 467 |
+
- train
|
| 468 |
+
- pill
|
| 469 |
+
- truck-movement
|
| 470 |
+
- car-logo-detection
|
| 471 |
+
- inbreast
|
| 472 |
+
- sea-cucumbers-new-tiles
|
| 473 |
+
- uavdet-small
|
| 474 |
+
- penguin-finder-seg
|
| 475 |
+
- aerial-airport
|
| 476 |
+
- bibdetection
|
| 477 |
+
- taco-trash-annotations-in-context
|
| 478 |
+
- bees
|
| 479 |
+
- recode-waste
|
| 480 |
+
- screwdetectclassification
|
| 481 |
+
- wine-labels
|
| 482 |
+
- aerial-cows
|
| 483 |
+
- into-the-vale
|
| 484 |
+
- gwhd2021
|
| 485 |
+
- lacrosse-object-detection
|
| 486 |
+
- defect-detection
|
| 487 |
+
- dataconvert
|
| 488 |
+
- x-ray-id
|
| 489 |
+
- ball
|
| 490 |
+
- tube
|
| 491 |
+
- 2024-frc
|
| 492 |
+
- crystal-clean-brain-tumors-mri-dataset
|
| 493 |
+
- grapes-5
|
| 494 |
+
- human-detection-in-floods
|
| 495 |
+
- buoy-onboarding
|
| 496 |
+
- apoce-aerial-photographs-for-object-detection-of-construction-equipment
|
| 497 |
+
- l10ul502
|
| 498 |
+
- floating-waste
|
| 499 |
+
- deeppcb
|
| 500 |
+
- ism-band-packet-detection
|
| 501 |
+
- weeds4
|
| 502 |
+
- invoice-processing
|
| 503 |
+
- thermal-cheetah
|
| 504 |
+
- tomatoes-2
|
| 505 |
+
- marine-sharks
|
| 506 |
+
- peixos-fish
|
| 507 |
+
- sssod
|
| 508 |
+
- aerial-pool
|
| 509 |
+
- countingpills
|
| 510 |
+
- asphaltdistressdetection
|
| 511 |
+
- roboflow-trained-dataset
|
| 512 |
+
- everdaynew
|
| 513 |
+
- underwater-objects
|
| 514 |
+
- soda-bottles
|
| 515 |
+
- dentalai
|
| 516 |
+
- jellyfish
|
| 517 |
+
- deepfruits
|
| 518 |
+
- activity-diagrams
|
| 519 |
+
- circuit-voltages
|
| 520 |
+
- all-elements
|
| 521 |
+
- macro-segmentation
|
| 522 |
+
- exploratorium-daphnia
|
| 523 |
+
- signatures
|
| 524 |
+
- conveyor-t-shirts
|
| 525 |
+
- fruitjes
|
| 526 |
+
- grass-weeds
|
| 527 |
+
- infraredimageofpowerequipment
|
| 528 |
+
- 13-lkc01
|
| 529 |
+
- wb-prova
|
| 530 |
+
- flir-camera-objects
|
| 531 |
+
- paper-parts
|
| 532 |
+
- football-player-detection
|
| 533 |
+
- trail-camera
|
| 534 |
+
- smd-components
|
| 535 |
+
- water-meter
|
| 536 |
+
- nih-xray
|
| 537 |
+
- the-dreidel-project
|
| 538 |
+
- electric-pylon-detection-in-rsi
|
| 539 |
+
- cable-damage
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/roboflow_v100/roboflow_v100_full_ft_100_images.yaml
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- _self_
|
| 4 |
+
|
| 5 |
+
# ============================================================================
|
| 6 |
+
# Paths Configuration (Chage this to your own paths)
|
| 7 |
+
# ============================================================================
|
| 8 |
+
paths:
|
| 9 |
+
roboflow_vl_100_root: <YOUR_DATASET_DIR>
|
| 10 |
+
experiment_log_dir: <YOUR EXPERIMENET LOG_DIR>
|
| 11 |
+
bpe_path: <BPE_PATH> # This should be under assets/bpe_simple_vocab_16e6.txt.gz
|
| 12 |
+
|
| 13 |
+
# Roboflow dataset configuration
|
| 14 |
+
roboflow_train:
|
| 15 |
+
num_images: 100 # Note: This is the number of images used for training. If null, all images are used.
|
| 16 |
+
supercategory: ${all_roboflow_supercategories.${string:${submitit.job_array.task_index}}}
|
| 17 |
+
|
| 18 |
+
# Training transforms pipeline
|
| 19 |
+
train_transforms:
|
| 20 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 21 |
+
transforms:
|
| 22 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 23 |
+
query_filter:
|
| 24 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterCrowds
|
| 25 |
+
- _target_: sam3.train.transforms.point_sampling.RandomizeInputBbox
|
| 26 |
+
box_noise_std: 0.1
|
| 27 |
+
box_noise_max: 20
|
| 28 |
+
- _target_: sam3.train.transforms.segmentation.DecodeRle
|
| 29 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 30 |
+
sizes:
|
| 31 |
+
_target_: sam3.train.transforms.basic.get_random_resize_scales
|
| 32 |
+
size: ${scratch.resolution}
|
| 33 |
+
min_size: 480
|
| 34 |
+
rounded: false
|
| 35 |
+
max_size:
|
| 36 |
+
_target_: sam3.train.transforms.basic.get_random_resize_max_size
|
| 37 |
+
size: ${scratch.resolution}
|
| 38 |
+
square: true
|
| 39 |
+
consistent_transform: ${scratch.consistent_transform}
|
| 40 |
+
- _target_: sam3.train.transforms.basic_for_api.PadToSizeAPI
|
| 41 |
+
size: ${scratch.resolution}
|
| 42 |
+
consistent_transform: ${scratch.consistent_transform}
|
| 43 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 44 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 45 |
+
query_filter:
|
| 46 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterEmptyTargets
|
| 47 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 48 |
+
mean: ${scratch.train_norm_mean}
|
| 49 |
+
std: ${scratch.train_norm_std}
|
| 50 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 51 |
+
query_filter:
|
| 52 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterEmptyTargets
|
| 53 |
+
- _target_: sam3.train.transforms.filter_query_transforms.FlexibleFilterFindGetQueries
|
| 54 |
+
query_filter:
|
| 55 |
+
_target_: sam3.train.transforms.filter_query_transforms.FilterFindQueriesWithTooManyOut
|
| 56 |
+
max_num_objects: ${scratch.max_ann_per_img}
|
| 57 |
+
|
| 58 |
+
# Validation transforms pipeline
|
| 59 |
+
val_transforms:
|
| 60 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 61 |
+
transforms:
|
| 62 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 63 |
+
sizes: ${scratch.resolution}
|
| 64 |
+
max_size:
|
| 65 |
+
_target_: sam3.train.transforms.basic.get_random_resize_max_size
|
| 66 |
+
size: ${scratch.resolution}
|
| 67 |
+
square: true
|
| 68 |
+
consistent_transform: False
|
| 69 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 70 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 71 |
+
mean: ${scratch.train_norm_mean}
|
| 72 |
+
std: ${scratch.train_norm_std}
|
| 73 |
+
|
| 74 |
+
# loss config (no mask loss)
|
| 75 |
+
loss:
|
| 76 |
+
_target_: sam3.train.loss.sam3_loss.Sam3LossWrapper
|
| 77 |
+
matcher: ${scratch.matcher}
|
| 78 |
+
o2m_weight: 2.0
|
| 79 |
+
o2m_matcher:
|
| 80 |
+
_target_: sam3.train.matcher.BinaryOneToManyMatcher
|
| 81 |
+
alpha: 0.3
|
| 82 |
+
threshold: 0.4
|
| 83 |
+
topk: 4
|
| 84 |
+
use_o2m_matcher_on_o2m_aux: false # Another option is true
|
| 85 |
+
loss_fns_find:
|
| 86 |
+
- _target_: sam3.train.loss.loss_fns.Boxes
|
| 87 |
+
weight_dict:
|
| 88 |
+
loss_bbox: 5.0
|
| 89 |
+
loss_giou: 2.0
|
| 90 |
+
- _target_: sam3.train.loss.loss_fns.IABCEMdetr
|
| 91 |
+
weak_loss: False
|
| 92 |
+
weight_dict:
|
| 93 |
+
loss_ce: 20.0 # Another option is 100.0
|
| 94 |
+
presence_loss: 20.0
|
| 95 |
+
pos_weight: 10.0 # Another option is 5.0
|
| 96 |
+
alpha: 0.25
|
| 97 |
+
gamma: 2
|
| 98 |
+
use_presence: True # Change
|
| 99 |
+
pos_focal: false
|
| 100 |
+
pad_n_queries: 200
|
| 101 |
+
pad_scale_pos: 1.0
|
| 102 |
+
|
| 103 |
+
loss_fn_semantic_seg: null
|
| 104 |
+
scale_by_find_batch_size: ${scratch.scale_by_find_batch_size}
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
# NOTE: Loss to be used for training in case of segmentation
|
| 108 |
+
# loss:
|
| 109 |
+
# _target_: sam3.train.loss.sam3_loss.Sam3LossWrapper
|
| 110 |
+
# matcher: ${scratch.matcher}
|
| 111 |
+
# o2m_weight: 2.0
|
| 112 |
+
# o2m_matcher:
|
| 113 |
+
# _target_: sam3.train.matcher.BinaryOneToManyMatcher
|
| 114 |
+
# alpha: 0.3
|
| 115 |
+
# threshold: 0.4
|
| 116 |
+
# topk: 4
|
| 117 |
+
# use_o2m_matcher_on_o2m_aux: false
|
| 118 |
+
# loss_fns_find:
|
| 119 |
+
# - _target_: sam3.train.loss.loss_fns.Boxes
|
| 120 |
+
# weight_dict:
|
| 121 |
+
# loss_bbox: 5.0
|
| 122 |
+
# loss_giou: 2.0
|
| 123 |
+
# - _target_: sam3.train.loss.loss_fns.IABCEMdetr
|
| 124 |
+
# weak_loss: False
|
| 125 |
+
# weight_dict:
|
| 126 |
+
# loss_ce: 20.0 # Another option is 100.0
|
| 127 |
+
# presence_loss: 20.0
|
| 128 |
+
# pos_weight: 10.0 # Another option is 5.0
|
| 129 |
+
# alpha: 0.25
|
| 130 |
+
# gamma: 2
|
| 131 |
+
# use_presence: True # Change
|
| 132 |
+
# pos_focal: false
|
| 133 |
+
# pad_n_queries: 200
|
| 134 |
+
# pad_scale_pos: 1.0
|
| 135 |
+
# - _target_: sam3.train.loss.loss_fns.Masks
|
| 136 |
+
# focal_alpha: 0.25
|
| 137 |
+
# focal_gamma: 2.0
|
| 138 |
+
# weight_dict:
|
| 139 |
+
# loss_mask: 200.0
|
| 140 |
+
# loss_dice: 10.0
|
| 141 |
+
# compute_aux: false
|
| 142 |
+
# loss_fn_semantic_seg:
|
| 143 |
+
# _target_: sam3.losses.loss_fns.SemanticSegCriterion
|
| 144 |
+
# presence_head: True
|
| 145 |
+
# presence_loss: False # Change
|
| 146 |
+
# focal: True
|
| 147 |
+
# focal_alpha: 0.6
|
| 148 |
+
# focal_gamma: 2.0
|
| 149 |
+
# downsample: False
|
| 150 |
+
# weight_dict:
|
| 151 |
+
# loss_semantic_seg: 20.0
|
| 152 |
+
# loss_semantic_presence: 1.0
|
| 153 |
+
# loss_semantic_dice: 30.0
|
| 154 |
+
# scale_by_find_batch_size: ${scratch.scale_by_find_batch_size}
|
| 155 |
+
|
| 156 |
+
# ============================================================================
|
| 157 |
+
# Different helper parameters and functions
|
| 158 |
+
# ============================================================================
|
| 159 |
+
scratch:
|
| 160 |
+
enable_segmentation: False # NOTE: This is the number of queries used for segmentation
|
| 161 |
+
# Model parameters
|
| 162 |
+
d_model: 256
|
| 163 |
+
pos_embed:
|
| 164 |
+
_target_: sam3.model.position_encoding.PositionEmbeddingSine
|
| 165 |
+
num_pos_feats: ${scratch.d_model}
|
| 166 |
+
normalize: true
|
| 167 |
+
scale: null
|
| 168 |
+
temperature: 10000
|
| 169 |
+
|
| 170 |
+
# Box processing
|
| 171 |
+
use_presence_eval: True
|
| 172 |
+
original_box_postprocessor:
|
| 173 |
+
_target_: sam3.eval.postprocessors.PostProcessImage
|
| 174 |
+
max_dets_per_img: -1 # infinite detections
|
| 175 |
+
use_original_ids: true
|
| 176 |
+
use_original_sizes_box: true
|
| 177 |
+
use_presence: ${scratch.use_presence_eval}
|
| 178 |
+
|
| 179 |
+
# Matcher configuration
|
| 180 |
+
matcher:
|
| 181 |
+
_target_: sam3.train.matcher.BinaryHungarianMatcherV2
|
| 182 |
+
focal: true # with `focal: true` it is equivalent to BinaryFocalHungarianMatcher
|
| 183 |
+
cost_class: 2.0
|
| 184 |
+
cost_bbox: 5.0
|
| 185 |
+
cost_giou: 2.0
|
| 186 |
+
alpha: 0.25
|
| 187 |
+
gamma: 2
|
| 188 |
+
stable: False
|
| 189 |
+
scale_by_find_batch_size: True
|
| 190 |
+
|
| 191 |
+
# Image processing parameters
|
| 192 |
+
resolution: 1008
|
| 193 |
+
consistent_transform: False
|
| 194 |
+
max_ann_per_img: 200
|
| 195 |
+
|
| 196 |
+
# Normalization parameters
|
| 197 |
+
train_norm_mean: [0.5, 0.5, 0.5]
|
| 198 |
+
train_norm_std: [0.5, 0.5, 0.5]
|
| 199 |
+
val_norm_mean: [0.5, 0.5, 0.5]
|
| 200 |
+
val_norm_std: [0.5, 0.5, 0.5]
|
| 201 |
+
|
| 202 |
+
# Training parameters
|
| 203 |
+
num_train_workers: 10
|
| 204 |
+
num_val_workers: 0
|
| 205 |
+
max_data_epochs: 20
|
| 206 |
+
target_epoch_size: 1500
|
| 207 |
+
hybrid_repeats: 1
|
| 208 |
+
context_length: 2
|
| 209 |
+
gather_pred_via_filesys: false
|
| 210 |
+
|
| 211 |
+
# Learning rate and scheduler parameters
|
| 212 |
+
lr_scale: 0.1
|
| 213 |
+
lr_transformer: ${times:8e-4,${scratch.lr_scale}}
|
| 214 |
+
lr_vision_backbone: ${times:2.5e-4,${scratch.lr_scale}}
|
| 215 |
+
lr_language_backbone: ${times:5e-5,${scratch.lr_scale}}
|
| 216 |
+
lrd_vision_backbone: 0.9
|
| 217 |
+
wd: 0.1
|
| 218 |
+
scheduler_timescale: 20
|
| 219 |
+
scheduler_warmup: 20
|
| 220 |
+
scheduler_cooldown: 20
|
| 221 |
+
|
| 222 |
+
val_batch_size: 1
|
| 223 |
+
collate_fn_val:
|
| 224 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 225 |
+
_partial_: true
|
| 226 |
+
repeats: ${scratch.hybrid_repeats}
|
| 227 |
+
dict_key: roboflow100
|
| 228 |
+
with_seg_masks: ${scratch.enable_segmentation} # Note: Set this to true if using segmentation masks!
|
| 229 |
+
|
| 230 |
+
gradient_accumulation_steps: 1
|
| 231 |
+
train_batch_size: 1
|
| 232 |
+
collate_fn:
|
| 233 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 234 |
+
_partial_: true
|
| 235 |
+
repeats: ${scratch.hybrid_repeats}
|
| 236 |
+
dict_key: all
|
| 237 |
+
with_seg_masks: ${scratch.enable_segmentation} # Note: Set this to true if using segmentation masks!
|
| 238 |
+
|
| 239 |
+
# ============================================================================
|
| 240 |
+
# Trainer Configuration
|
| 241 |
+
# ============================================================================
|
| 242 |
+
|
| 243 |
+
trainer:
|
| 244 |
+
|
| 245 |
+
_target_: sam3.train.trainer.Trainer
|
| 246 |
+
skip_saving_ckpts: true
|
| 247 |
+
empty_gpu_mem_cache_after_eval: True
|
| 248 |
+
skip_first_val: True
|
| 249 |
+
max_epochs: 20
|
| 250 |
+
accelerator: cuda
|
| 251 |
+
seed_value: 123
|
| 252 |
+
val_epoch_freq: 10
|
| 253 |
+
mode: train
|
| 254 |
+
gradient_accumulation_steps: ${scratch.gradient_accumulation_steps}
|
| 255 |
+
|
| 256 |
+
distributed:
|
| 257 |
+
backend: nccl
|
| 258 |
+
find_unused_parameters: True
|
| 259 |
+
gradient_as_bucket_view: True
|
| 260 |
+
|
| 261 |
+
loss:
|
| 262 |
+
all: ${roboflow_train.loss}
|
| 263 |
+
default:
|
| 264 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 265 |
+
|
| 266 |
+
data:
|
| 267 |
+
train:
|
| 268 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 269 |
+
dataset:
|
| 270 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 271 |
+
limit_ids: ${roboflow_train.num_images}
|
| 272 |
+
transforms: ${roboflow_train.train_transforms}
|
| 273 |
+
load_segmentation: ${scratch.enable_segmentation}
|
| 274 |
+
max_ann_per_img: 500000
|
| 275 |
+
multiplier: 1
|
| 276 |
+
max_train_queries: 50000
|
| 277 |
+
max_val_queries: 50000
|
| 278 |
+
training: true
|
| 279 |
+
use_caching: False
|
| 280 |
+
img_folder: ${paths.roboflow_vl_100_root}/${roboflow_train.supercategory}/train/
|
| 281 |
+
ann_file: ${paths.roboflow_vl_100_root}/${roboflow_train.supercategory}/train/_annotations.coco.json
|
| 282 |
+
|
| 283 |
+
shuffle: True
|
| 284 |
+
batch_size: ${scratch.train_batch_size}
|
| 285 |
+
num_workers: ${scratch.num_train_workers}
|
| 286 |
+
pin_memory: True
|
| 287 |
+
drop_last: True
|
| 288 |
+
collate_fn: ${scratch.collate_fn}
|
| 289 |
+
|
| 290 |
+
val:
|
| 291 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 292 |
+
dataset:
|
| 293 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 294 |
+
load_segmentation: ${scratch.enable_segmentation}
|
| 295 |
+
coco_json_loader:
|
| 296 |
+
_target_: sam3.train.data.coco_json_loaders.COCO_FROM_JSON
|
| 297 |
+
include_negatives: true
|
| 298 |
+
category_chunk_size: 2 # Note: You can increase this based on the memory of your GPU.
|
| 299 |
+
_partial_: true
|
| 300 |
+
img_folder: ${paths.roboflow_vl_100_root}/${roboflow_train.supercategory}/test/
|
| 301 |
+
ann_file: ${paths.roboflow_vl_100_root}/${roboflow_train.supercategory}/test/_annotations.coco.json
|
| 302 |
+
transforms: ${roboflow_train.val_transforms}
|
| 303 |
+
max_ann_per_img: 100000
|
| 304 |
+
multiplier: 1
|
| 305 |
+
training: false
|
| 306 |
+
|
| 307 |
+
shuffle: False
|
| 308 |
+
batch_size: ${scratch.val_batch_size}
|
| 309 |
+
num_workers: ${scratch.num_val_workers}
|
| 310 |
+
pin_memory: True
|
| 311 |
+
drop_last: False
|
| 312 |
+
collate_fn: ${scratch.collate_fn_val}
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
model:
|
| 316 |
+
_target_: sam3.model_builder.build_sam3_image_model
|
| 317 |
+
bpe_path: ${paths.bpe_path}
|
| 318 |
+
device: cpus
|
| 319 |
+
eval_mode: false
|
| 320 |
+
enable_segmentation: ${scratch.enable_segmentation} # Warning: Enable this if using segmentation.
|
| 321 |
+
|
| 322 |
+
meters:
|
| 323 |
+
val:
|
| 324 |
+
roboflow100:
|
| 325 |
+
detection:
|
| 326 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 327 |
+
iou_type: "bbox"
|
| 328 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/roboflow/${roboflow_train.supercategory}
|
| 329 |
+
merge_predictions: True
|
| 330 |
+
postprocessor: ${scratch.original_box_postprocessor}
|
| 331 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 332 |
+
maxdets: 100
|
| 333 |
+
pred_file_evaluators:
|
| 334 |
+
- _target_: sam3.eval.coco_eval_offline.CocoEvaluatorOfflineWithPredFileEvaluators
|
| 335 |
+
gt_path: ${paths.roboflow_vl_100_root}/${roboflow_train.supercategory}/test/_annotations.coco.json
|
| 336 |
+
tide: False
|
| 337 |
+
iou_type: "bbox"
|
| 338 |
+
|
| 339 |
+
optim:
|
| 340 |
+
amp:
|
| 341 |
+
enabled: True
|
| 342 |
+
amp_dtype: bfloat16
|
| 343 |
+
|
| 344 |
+
optimizer:
|
| 345 |
+
_target_: torch.optim.AdamW
|
| 346 |
+
|
| 347 |
+
gradient_clip:
|
| 348 |
+
_target_: sam3.train.optim.optimizer.GradientClipper
|
| 349 |
+
max_norm: 0.1
|
| 350 |
+
norm_type: 2
|
| 351 |
+
|
| 352 |
+
param_group_modifiers:
|
| 353 |
+
- _target_: sam3.train.optim.optimizer.layer_decay_param_modifier
|
| 354 |
+
_partial_: True
|
| 355 |
+
layer_decay_value: ${scratch.lrd_vision_backbone}
|
| 356 |
+
apply_to: 'backbone.vision_backbone.trunk'
|
| 357 |
+
overrides:
|
| 358 |
+
- pattern: '*pos_embed*'
|
| 359 |
+
value: 1.0
|
| 360 |
+
|
| 361 |
+
options:
|
| 362 |
+
lr:
|
| 363 |
+
- scheduler: # transformer and class_embed
|
| 364 |
+
_target_: sam3.train.optim.schedulers.InverseSquareRootParamScheduler
|
| 365 |
+
base_lr: ${scratch.lr_transformer}
|
| 366 |
+
timescale: ${scratch.scheduler_timescale}
|
| 367 |
+
warmup_steps: ${scratch.scheduler_warmup}
|
| 368 |
+
cooldown_steps: ${scratch.scheduler_cooldown}
|
| 369 |
+
- scheduler:
|
| 370 |
+
_target_: sam3.train.optim.schedulers.InverseSquareRootParamScheduler
|
| 371 |
+
base_lr: ${scratch.lr_vision_backbone}
|
| 372 |
+
timescale: ${scratch.scheduler_timescale}
|
| 373 |
+
warmup_steps: ${scratch.scheduler_warmup}
|
| 374 |
+
cooldown_steps: ${scratch.scheduler_cooldown}
|
| 375 |
+
param_names:
|
| 376 |
+
- 'backbone.vision_backbone.*'
|
| 377 |
+
- scheduler:
|
| 378 |
+
_target_: sam3.train.optim.schedulers.InverseSquareRootParamScheduler
|
| 379 |
+
base_lr: ${scratch.lr_language_backbone}
|
| 380 |
+
timescale: ${scratch.scheduler_timescale}
|
| 381 |
+
warmup_steps: ${scratch.scheduler_warmup}
|
| 382 |
+
cooldown_steps: ${scratch.scheduler_cooldown}
|
| 383 |
+
param_names:
|
| 384 |
+
- 'backbone.language_backbone.*'
|
| 385 |
+
|
| 386 |
+
weight_decay:
|
| 387 |
+
- scheduler:
|
| 388 |
+
_target_: fvcore.common.param_scheduler.ConstantParamScheduler
|
| 389 |
+
value: ${scratch.wd}
|
| 390 |
+
- scheduler:
|
| 391 |
+
_target_: fvcore.common.param_scheduler.ConstantParamScheduler
|
| 392 |
+
value: 0.0
|
| 393 |
+
param_names:
|
| 394 |
+
- '*bias*'
|
| 395 |
+
module_cls_names: ['torch.nn.LayerNorm']
|
| 396 |
+
|
| 397 |
+
checkpoint:
|
| 398 |
+
save_dir: ${launcher.experiment_log_dir}/checkpoints
|
| 399 |
+
save_freq: 0 # 0 only last checkpoint is saved.
|
| 400 |
+
|
| 401 |
+
logging:
|
| 402 |
+
tensorboard_writer:
|
| 403 |
+
_target_: sam3.train.utils.logger.make_tensorboard_logger
|
| 404 |
+
log_dir: ${launcher.experiment_log_dir}/tensorboard
|
| 405 |
+
flush_secs: 120
|
| 406 |
+
should_log: True
|
| 407 |
+
wandb_writer: null
|
| 408 |
+
log_dir: ${launcher.experiment_log_dir}/logs/${roboflow_train.supercategory}
|
| 409 |
+
log_freq: 10
|
| 410 |
+
|
| 411 |
+
# ============================================================================
|
| 412 |
+
# Launcher and Submitit Configuration
|
| 413 |
+
# ============================================================================
|
| 414 |
+
|
| 415 |
+
launcher:
|
| 416 |
+
num_nodes: 1
|
| 417 |
+
gpus_per_node: 2
|
| 418 |
+
experiment_log_dir: ${paths.experiment_log_dir}
|
| 419 |
+
multiprocessing_context: forkserver
|
| 420 |
+
|
| 421 |
+
submitit:
|
| 422 |
+
account: null
|
| 423 |
+
partition: null
|
| 424 |
+
qos: null
|
| 425 |
+
timeout_hour: 72
|
| 426 |
+
use_cluster: True
|
| 427 |
+
cpus_per_task: 10
|
| 428 |
+
port_range: [10000, 65000]
|
| 429 |
+
constraint: null
|
| 430 |
+
# Uncomment for job array configuration
|
| 431 |
+
job_array:
|
| 432 |
+
num_tasks: 100
|
| 433 |
+
task_index: 0
|
| 434 |
+
|
| 435 |
+
# ============================================================================
|
| 436 |
+
# Available Roboflow Supercategories (for reference)
|
| 437 |
+
# ============================================================================
|
| 438 |
+
|
| 439 |
+
all_roboflow_supercategories:
|
| 440 |
+
- -grccs
|
| 441 |
+
- zebrasatasturias
|
| 442 |
+
- cod-mw-warzone
|
| 443 |
+
- canalstenosis
|
| 444 |
+
- label-printing-defect-version-2
|
| 445 |
+
- new-defects-in-wood
|
| 446 |
+
- orionproducts
|
| 447 |
+
- aquarium-combined
|
| 448 |
+
- varroa-mites-detection--test-set
|
| 449 |
+
- clashroyalechardetector
|
| 450 |
+
- stomata-cells
|
| 451 |
+
- halo-infinite-angel-videogame
|
| 452 |
+
- pig-detection
|
| 453 |
+
- urine-analysis1
|
| 454 |
+
- aerial-sheep
|
| 455 |
+
- orgharvest
|
| 456 |
+
- actions
|
| 457 |
+
- mahjong
|
| 458 |
+
- liver-disease
|
| 459 |
+
- needle-base-tip-min-max
|
| 460 |
+
- wheel-defect-detection
|
| 461 |
+
- aircraft-turnaround-dataset
|
| 462 |
+
- xray
|
| 463 |
+
- wildfire-smoke
|
| 464 |
+
- spinefrxnormalvindr
|
| 465 |
+
- ufba-425
|
| 466 |
+
- speech-bubbles-detection
|
| 467 |
+
- train
|
| 468 |
+
- pill
|
| 469 |
+
- truck-movement
|
| 470 |
+
- car-logo-detection
|
| 471 |
+
- inbreast
|
| 472 |
+
- sea-cucumbers-new-tiles
|
| 473 |
+
- uavdet-small
|
| 474 |
+
- penguin-finder-seg
|
| 475 |
+
- aerial-airport
|
| 476 |
+
- bibdetection
|
| 477 |
+
- taco-trash-annotations-in-context
|
| 478 |
+
- bees
|
| 479 |
+
- recode-waste
|
| 480 |
+
- screwdetectclassification
|
| 481 |
+
- wine-labels
|
| 482 |
+
- aerial-cows
|
| 483 |
+
- into-the-vale
|
| 484 |
+
- gwhd2021
|
| 485 |
+
- lacrosse-object-detection
|
| 486 |
+
- defect-detection
|
| 487 |
+
- dataconvert
|
| 488 |
+
- x-ray-id
|
| 489 |
+
- ball
|
| 490 |
+
- tube
|
| 491 |
+
- 2024-frc
|
| 492 |
+
- crystal-clean-brain-tumors-mri-dataset
|
| 493 |
+
- grapes-5
|
| 494 |
+
- human-detection-in-floods
|
| 495 |
+
- buoy-onboarding
|
| 496 |
+
- apoce-aerial-photographs-for-object-detection-of-construction-equipment
|
| 497 |
+
- l10ul502
|
| 498 |
+
- floating-waste
|
| 499 |
+
- deeppcb
|
| 500 |
+
- ism-band-packet-detection
|
| 501 |
+
- weeds4
|
| 502 |
+
- invoice-processing
|
| 503 |
+
- thermal-cheetah
|
| 504 |
+
- tomatoes-2
|
| 505 |
+
- marine-sharks
|
| 506 |
+
- peixos-fish
|
| 507 |
+
- sssod
|
| 508 |
+
- aerial-pool
|
| 509 |
+
- countingpills
|
| 510 |
+
- asphaltdistressdetection
|
| 511 |
+
- roboflow-trained-dataset
|
| 512 |
+
- everdaynew
|
| 513 |
+
- underwater-objects
|
| 514 |
+
- soda-bottles
|
| 515 |
+
- dentalai
|
| 516 |
+
- jellyfish
|
| 517 |
+
- deepfruits
|
| 518 |
+
- activity-diagrams
|
| 519 |
+
- circuit-voltages
|
| 520 |
+
- all-elements
|
| 521 |
+
- macro-segmentation
|
| 522 |
+
- exploratorium-daphnia
|
| 523 |
+
- signatures
|
| 524 |
+
- conveyor-t-shirts
|
| 525 |
+
- fruitjes
|
| 526 |
+
- grass-weeds
|
| 527 |
+
- infraredimageofpowerequipment
|
| 528 |
+
- 13-lkc01
|
| 529 |
+
- wb-prova
|
| 530 |
+
- flir-camera-objects
|
| 531 |
+
- paper-parts
|
| 532 |
+
- football-player-detection
|
| 533 |
+
- trail-camera
|
| 534 |
+
- smd-components
|
| 535 |
+
- water-meter
|
| 536 |
+
- nih-xray
|
| 537 |
+
- the-dreidel-project
|
| 538 |
+
- electric-pylon-detection-in-rsi
|
| 539 |
+
- cable-damage
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/saco_video_evals/saco_veval_sav_test.yaml
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- _self_
|
| 4 |
+
|
| 5 |
+
# ============================================================================
|
| 6 |
+
# Paths Configuration (Chage this to your own paths)
|
| 7 |
+
# ============================================================================
|
| 8 |
+
paths:
|
| 9 |
+
|
| 10 |
+
dump_file_name: saco_veval_sav_test
|
| 11 |
+
experiment_log_dir: <YOUR EXPERIMENET LOG_DIR>
|
| 12 |
+
ytvis_json: <YOUR_GT_PATH>/saco_veval_sav_test.json
|
| 13 |
+
ytvis_dir : <YOUR_VIDEO_JPG_DIR>
|
| 14 |
+
bpe_path: <BPE_PATH> # This should be under assets/bpe_simple_vocab_16e6.txt.gz
|
| 15 |
+
num_videos: null
|
| 16 |
+
|
| 17 |
+
# ============================================================================
|
| 18 |
+
# Different helper parameters and functions
|
| 19 |
+
# ============================================================================
|
| 20 |
+
scratch:
|
| 21 |
+
vid_mask_postprocessor:
|
| 22 |
+
_target_: sam3.eval.postprocessors.PostProcessNullOp
|
| 23 |
+
|
| 24 |
+
use_presence_eval: True
|
| 25 |
+
|
| 26 |
+
video_transforms_val:
|
| 27 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 28 |
+
transforms:
|
| 29 |
+
- _target_: sam3.train.transforms.segmentation.DecodeRle
|
| 30 |
+
# resize the image to 1024x1024 resolution
|
| 31 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 32 |
+
sizes: ${scratch.resolution} # originally `resolution: 1024`
|
| 33 |
+
square: true
|
| 34 |
+
consistent_transform: true
|
| 35 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 36 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 37 |
+
mean: ${scratch.val_norm_mean}
|
| 38 |
+
std: ${scratch.val_norm_std}
|
| 39 |
+
|
| 40 |
+
# Model parameters
|
| 41 |
+
d_model: 256
|
| 42 |
+
|
| 43 |
+
# Image processing parameters
|
| 44 |
+
resolution: 1008
|
| 45 |
+
|
| 46 |
+
# Normalization parameters
|
| 47 |
+
train_norm_mean: [0.5, 0.5, 0.5]
|
| 48 |
+
train_norm_std: [0.5, 0.5, 0.5]
|
| 49 |
+
val_norm_mean: [0.5, 0.5, 0.5]
|
| 50 |
+
val_norm_std: [0.5, 0.5, 0.5]
|
| 51 |
+
|
| 52 |
+
val_batch_size: 1
|
| 53 |
+
num_val_workers: 0
|
| 54 |
+
max_data_epochs: 20
|
| 55 |
+
hybrid_repeats: 1
|
| 56 |
+
gather_pred_via_filesys: false
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
# ============================================================================
|
| 60 |
+
# Trainer Configuration
|
| 61 |
+
# ============================================================================
|
| 62 |
+
|
| 63 |
+
trainer:
|
| 64 |
+
_target_: sam3.train.trainer.Trainer
|
| 65 |
+
skip_saving_ckpts: true
|
| 66 |
+
empty_gpu_mem_cache_after_eval: True
|
| 67 |
+
skip_first_val: True
|
| 68 |
+
max_epochs: ${scratch.max_data_epochs}
|
| 69 |
+
accelerator: cuda
|
| 70 |
+
seed_value: 123
|
| 71 |
+
val_epoch_freq: 10
|
| 72 |
+
mode: val
|
| 73 |
+
|
| 74 |
+
distributed:
|
| 75 |
+
backend: nccl
|
| 76 |
+
find_unused_parameters: True
|
| 77 |
+
gradient_as_bucket_view: True
|
| 78 |
+
|
| 79 |
+
loss:
|
| 80 |
+
all:
|
| 81 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 82 |
+
default:
|
| 83 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 84 |
+
|
| 85 |
+
data:
|
| 86 |
+
train: null
|
| 87 |
+
val:
|
| 88 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 89 |
+
dataset:
|
| 90 |
+
_target_: sam3.train.data.sam3_video_dataset.VideoGroundingDataset
|
| 91 |
+
limit_ids: ${paths.num_videos}
|
| 92 |
+
img_folder: ${paths.ytvis_dir}
|
| 93 |
+
ann_file: ${paths.ytvis_json}
|
| 94 |
+
coco_json_loader:
|
| 95 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_VEVAL_API_FROM_JSON_NP
|
| 96 |
+
_partial_: true
|
| 97 |
+
|
| 98 |
+
transforms: ${scratch.video_transforms_val}
|
| 99 |
+
max_ann_per_img: 100000 # filtered in transforms
|
| 100 |
+
max_val_queries: 100000
|
| 101 |
+
multiplier: 1
|
| 102 |
+
load_segmentation: true
|
| 103 |
+
training: false
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
shuffle: False
|
| 107 |
+
batch_size: ${scratch.val_batch_size}
|
| 108 |
+
num_workers: ${scratch.num_val_workers}
|
| 109 |
+
pin_memory: True
|
| 110 |
+
drop_last: False
|
| 111 |
+
collate_fn:
|
| 112 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 113 |
+
_partial_: true
|
| 114 |
+
repeats: ${scratch.hybrid_repeats}
|
| 115 |
+
dict_key: ytvis_val
|
| 116 |
+
with_seg_masks: true
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
model:
|
| 120 |
+
_target_: sam3.model_builder.build_sam3_video_model
|
| 121 |
+
bpe_path: ${paths.bpe_path}
|
| 122 |
+
has_presence_token: True
|
| 123 |
+
geo_encoder_use_img_cross_attn: True
|
| 124 |
+
apply_temporal_disambiguation: True
|
| 125 |
+
|
| 126 |
+
meters:
|
| 127 |
+
val:
|
| 128 |
+
ytvis_val:
|
| 129 |
+
pred_file: # key
|
| 130 |
+
_target_: sam3.eval.ytvis_eval.YTVISResultsWriter
|
| 131 |
+
dump_file: ${launcher.experiment_log_dir}/preds/${paths.dump_file_name}.json
|
| 132 |
+
postprocessor: ${scratch.vid_mask_postprocessor}
|
| 133 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 134 |
+
|
| 135 |
+
optim:
|
| 136 |
+
amp:
|
| 137 |
+
enabled: True
|
| 138 |
+
amp_dtype: bfloat16
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
checkpoint:
|
| 142 |
+
save_dir: ${launcher.experiment_log_dir}/checkpoints
|
| 143 |
+
save_freq: 0 # 0 only last checkpoint is saved.
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
logging:
|
| 147 |
+
tensorboard_writer:
|
| 148 |
+
_target_: sam3.train.utils.logger.make_tensorboard_logger
|
| 149 |
+
log_dir: ${launcher.experiment_log_dir}/tensorboard
|
| 150 |
+
flush_secs: 120
|
| 151 |
+
should_log: True
|
| 152 |
+
wandb_writer: null
|
| 153 |
+
log_dir: ${launcher.experiment_log_dir}/logs/
|
| 154 |
+
log_freq: 10
|
| 155 |
+
|
| 156 |
+
# ============================================================================
|
| 157 |
+
# Launcher and Submitit Configuration
|
| 158 |
+
# ============================================================================
|
| 159 |
+
|
| 160 |
+
launcher:
|
| 161 |
+
num_nodes: 8
|
| 162 |
+
gpus_per_node: 8
|
| 163 |
+
experiment_log_dir: ${paths.experiment_log_dir}
|
| 164 |
+
multiprocessing_context: forkserver
|
| 165 |
+
|
| 166 |
+
submitit:
|
| 167 |
+
account: null
|
| 168 |
+
partition: null
|
| 169 |
+
qos: null
|
| 170 |
+
timeout_hour: 72
|
| 171 |
+
use_cluster: True
|
| 172 |
+
cpus_per_task: 10
|
| 173 |
+
port_range: [10000, 65000]
|
| 174 |
+
constraint: null
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/saco_video_evals/saco_veval_sav_val.yaml
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- _self_
|
| 4 |
+
|
| 5 |
+
# ============================================================================
|
| 6 |
+
# Paths Configuration (Chage this to your own paths)
|
| 7 |
+
# ============================================================================
|
| 8 |
+
paths:
|
| 9 |
+
|
| 10 |
+
dump_file_name: saco_veval_sav_val
|
| 11 |
+
experiment_log_dir: <YOUR EXPERIMENET LOG_DIR>
|
| 12 |
+
ytvis_json: <YOUR_GT_PATH>/saco_veval_sav_val.json
|
| 13 |
+
ytvis_dir : <YOUR_VIDEO_JPG_DIR>
|
| 14 |
+
bpe_path: <BPE_PATH> # This should be under assets/bpe_simple_vocab_16e6.txt.gz
|
| 15 |
+
num_videos: null
|
| 16 |
+
|
| 17 |
+
# ============================================================================
|
| 18 |
+
# Different helper parameters and functions
|
| 19 |
+
# ============================================================================
|
| 20 |
+
scratch:
|
| 21 |
+
vid_mask_postprocessor:
|
| 22 |
+
_target_: sam3.eval.postprocessors.PostProcessNullOp
|
| 23 |
+
|
| 24 |
+
use_presence_eval: True
|
| 25 |
+
|
| 26 |
+
video_transforms_val:
|
| 27 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 28 |
+
transforms:
|
| 29 |
+
- _target_: sam3.train.transforms.segmentation.DecodeRle
|
| 30 |
+
# resize the image to 1024x1024 resolution
|
| 31 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 32 |
+
sizes: ${scratch.resolution} # originally `resolution: 1024`
|
| 33 |
+
square: true
|
| 34 |
+
consistent_transform: true
|
| 35 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 36 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 37 |
+
mean: ${scratch.val_norm_mean}
|
| 38 |
+
std: ${scratch.val_norm_std}
|
| 39 |
+
|
| 40 |
+
# Model parameters
|
| 41 |
+
d_model: 256
|
| 42 |
+
|
| 43 |
+
# Image processing parameters
|
| 44 |
+
resolution: 1008
|
| 45 |
+
|
| 46 |
+
# Normalization parameters
|
| 47 |
+
train_norm_mean: [0.5, 0.5, 0.5]
|
| 48 |
+
train_norm_std: [0.5, 0.5, 0.5]
|
| 49 |
+
val_norm_mean: [0.5, 0.5, 0.5]
|
| 50 |
+
val_norm_std: [0.5, 0.5, 0.5]
|
| 51 |
+
|
| 52 |
+
val_batch_size: 1
|
| 53 |
+
num_val_workers: 0
|
| 54 |
+
max_data_epochs: 20
|
| 55 |
+
hybrid_repeats: 1
|
| 56 |
+
gather_pred_via_filesys: false
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
# ============================================================================
|
| 60 |
+
# Trainer Configuration
|
| 61 |
+
# ============================================================================
|
| 62 |
+
|
| 63 |
+
trainer:
|
| 64 |
+
_target_: sam3.train.trainer.Trainer
|
| 65 |
+
skip_saving_ckpts: true
|
| 66 |
+
empty_gpu_mem_cache_after_eval: True
|
| 67 |
+
skip_first_val: True
|
| 68 |
+
max_epochs: ${scratch.max_data_epochs}
|
| 69 |
+
accelerator: cuda
|
| 70 |
+
seed_value: 123
|
| 71 |
+
val_epoch_freq: 10
|
| 72 |
+
mode: val
|
| 73 |
+
|
| 74 |
+
distributed:
|
| 75 |
+
backend: nccl
|
| 76 |
+
find_unused_parameters: True
|
| 77 |
+
gradient_as_bucket_view: True
|
| 78 |
+
|
| 79 |
+
loss:
|
| 80 |
+
all:
|
| 81 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 82 |
+
default:
|
| 83 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 84 |
+
|
| 85 |
+
data:
|
| 86 |
+
train: null
|
| 87 |
+
val:
|
| 88 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 89 |
+
dataset:
|
| 90 |
+
_target_: sam3.train.data.sam3_video_dataset.VideoGroundingDataset
|
| 91 |
+
limit_ids: ${paths.num_videos}
|
| 92 |
+
img_folder: ${paths.ytvis_dir}
|
| 93 |
+
ann_file: ${paths.ytvis_json}
|
| 94 |
+
coco_json_loader:
|
| 95 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_VEVAL_API_FROM_JSON_NP
|
| 96 |
+
_partial_: true
|
| 97 |
+
|
| 98 |
+
transforms: ${scratch.video_transforms_val}
|
| 99 |
+
max_ann_per_img: 100000 # filtered in transforms
|
| 100 |
+
max_val_queries: 100000
|
| 101 |
+
multiplier: 1
|
| 102 |
+
load_segmentation: true
|
| 103 |
+
training: false
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
shuffle: False
|
| 107 |
+
batch_size: ${scratch.val_batch_size}
|
| 108 |
+
num_workers: ${scratch.num_val_workers}
|
| 109 |
+
pin_memory: True
|
| 110 |
+
drop_last: False
|
| 111 |
+
collate_fn:
|
| 112 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 113 |
+
_partial_: true
|
| 114 |
+
repeats: ${scratch.hybrid_repeats}
|
| 115 |
+
dict_key: ytvis_val
|
| 116 |
+
with_seg_masks: true
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
model:
|
| 120 |
+
_target_: sam3.model_builder.build_sam3_video_model
|
| 121 |
+
bpe_path: ${paths.bpe_path}
|
| 122 |
+
has_presence_token: True
|
| 123 |
+
geo_encoder_use_img_cross_attn: True
|
| 124 |
+
apply_temporal_disambiguation: True
|
| 125 |
+
|
| 126 |
+
meters:
|
| 127 |
+
val:
|
| 128 |
+
ytvis_val:
|
| 129 |
+
pred_file: # key
|
| 130 |
+
_target_: sam3.eval.ytvis_eval.YTVISResultsWriter
|
| 131 |
+
dump_file: ${launcher.experiment_log_dir}/preds/${paths.dump_file_name}.json
|
| 132 |
+
postprocessor: ${scratch.vid_mask_postprocessor}
|
| 133 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 134 |
+
|
| 135 |
+
optim:
|
| 136 |
+
amp:
|
| 137 |
+
enabled: True
|
| 138 |
+
amp_dtype: bfloat16
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
checkpoint:
|
| 142 |
+
save_dir: ${launcher.experiment_log_dir}/checkpoints
|
| 143 |
+
save_freq: 0 # 0 only last checkpoint is saved.
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
logging:
|
| 147 |
+
tensorboard_writer:
|
| 148 |
+
_target_: sam3.train.utils.logger.make_tensorboard_logger
|
| 149 |
+
log_dir: ${launcher.experiment_log_dir}/tensorboard
|
| 150 |
+
flush_secs: 120
|
| 151 |
+
should_log: True
|
| 152 |
+
wandb_writer: null
|
| 153 |
+
log_dir: ${launcher.experiment_log_dir}/logs/
|
| 154 |
+
log_freq: 10
|
| 155 |
+
|
| 156 |
+
# ============================================================================
|
| 157 |
+
# Launcher and Submitit Configuration
|
| 158 |
+
# ============================================================================
|
| 159 |
+
|
| 160 |
+
launcher:
|
| 161 |
+
num_nodes: 8
|
| 162 |
+
gpus_per_node: 8
|
| 163 |
+
experiment_log_dir: ${paths.experiment_log_dir}
|
| 164 |
+
multiprocessing_context: forkserver
|
| 165 |
+
|
| 166 |
+
submitit:
|
| 167 |
+
account: null
|
| 168 |
+
partition: null
|
| 169 |
+
qos: null
|
| 170 |
+
timeout_hour: 72
|
| 171 |
+
use_cluster: True
|
| 172 |
+
cpus_per_task: 10
|
| 173 |
+
port_range: [10000, 65000]
|
| 174 |
+
constraint: null
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/saco_video_evals/saco_veval_yt1b_test_noheur.yaml
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- _self_
|
| 4 |
+
|
| 5 |
+
# ============================================================================
|
| 6 |
+
# Paths Configuration (Chage this to your own paths)
|
| 7 |
+
# ============================================================================
|
| 8 |
+
paths:
|
| 9 |
+
|
| 10 |
+
dump_file_name: saco_veval_yt1b_test
|
| 11 |
+
experiment_log_dir: <YOUR EXPERIMENET LOG_DIR>
|
| 12 |
+
ytvis_json: <YOUR_GT_PATH>/saco_veval_yt1b_test.json
|
| 13 |
+
ytvis_dir : <YOUR_VIDEO_JPG_DIR>
|
| 14 |
+
bpe_path: <BPE_PATH> # This should be under assets/bpe_simple_vocab_16e6.txt.gz
|
| 15 |
+
num_videos: null
|
| 16 |
+
|
| 17 |
+
# ============================================================================
|
| 18 |
+
# Different helper parameters and functions
|
| 19 |
+
# ============================================================================
|
| 20 |
+
scratch:
|
| 21 |
+
vid_mask_postprocessor:
|
| 22 |
+
_target_: sam3.eval.postprocessors.PostProcessNullOp
|
| 23 |
+
|
| 24 |
+
use_presence_eval: True
|
| 25 |
+
|
| 26 |
+
video_transforms_val:
|
| 27 |
+
- _target_: sam3.train.transforms.basic_for_api.ComposeAPI
|
| 28 |
+
transforms:
|
| 29 |
+
- _target_: sam3.train.transforms.segmentation.DecodeRle
|
| 30 |
+
# resize the image to 1024x1024 resolution
|
| 31 |
+
- _target_: sam3.train.transforms.basic_for_api.RandomResizeAPI
|
| 32 |
+
sizes: ${scratch.resolution} # originally `resolution: 1024`
|
| 33 |
+
square: true
|
| 34 |
+
consistent_transform: true
|
| 35 |
+
- _target_: sam3.train.transforms.basic_for_api.ToTensorAPI
|
| 36 |
+
- _target_: sam3.train.transforms.basic_for_api.NormalizeAPI
|
| 37 |
+
mean: ${scratch.val_norm_mean}
|
| 38 |
+
std: ${scratch.val_norm_std}
|
| 39 |
+
|
| 40 |
+
# Model parameters
|
| 41 |
+
d_model: 256
|
| 42 |
+
|
| 43 |
+
# Image processing parameters
|
| 44 |
+
resolution: 1008
|
| 45 |
+
|
| 46 |
+
# Normalization parameters
|
| 47 |
+
train_norm_mean: [0.5, 0.5, 0.5]
|
| 48 |
+
train_norm_std: [0.5, 0.5, 0.5]
|
| 49 |
+
val_norm_mean: [0.5, 0.5, 0.5]
|
| 50 |
+
val_norm_std: [0.5, 0.5, 0.5]
|
| 51 |
+
|
| 52 |
+
val_batch_size: 1
|
| 53 |
+
num_val_workers: 0
|
| 54 |
+
max_data_epochs: 20
|
| 55 |
+
hybrid_repeats: 1
|
| 56 |
+
gather_pred_via_filesys: false
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
# ============================================================================
|
| 60 |
+
# Trainer Configuration
|
| 61 |
+
# ============================================================================
|
| 62 |
+
|
| 63 |
+
trainer:
|
| 64 |
+
_target_: sam3.train.trainer.Trainer
|
| 65 |
+
skip_saving_ckpts: true
|
| 66 |
+
empty_gpu_mem_cache_after_eval: True
|
| 67 |
+
skip_first_val: True
|
| 68 |
+
max_epochs: ${scratch.max_data_epochs}
|
| 69 |
+
accelerator: cuda
|
| 70 |
+
seed_value: 123
|
| 71 |
+
val_epoch_freq: 10
|
| 72 |
+
mode: val
|
| 73 |
+
|
| 74 |
+
distributed:
|
| 75 |
+
backend: nccl
|
| 76 |
+
find_unused_parameters: True
|
| 77 |
+
gradient_as_bucket_view: True
|
| 78 |
+
|
| 79 |
+
loss:
|
| 80 |
+
all:
|
| 81 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 82 |
+
default:
|
| 83 |
+
_target_: sam3.train.loss.sam3_loss.DummyLoss
|
| 84 |
+
|
| 85 |
+
data:
|
| 86 |
+
train: null
|
| 87 |
+
val:
|
| 88 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 89 |
+
dataset:
|
| 90 |
+
_target_: sam3.train.data.sam3_video_dataset.VideoGroundingDataset
|
| 91 |
+
limit_ids: ${paths.num_videos}
|
| 92 |
+
img_folder: ${paths.ytvis_dir}
|
| 93 |
+
ann_file: ${paths.ytvis_json}
|
| 94 |
+
coco_json_loader:
|
| 95 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_VEVAL_API_FROM_JSON_NP
|
| 96 |
+
_partial_: true
|
| 97 |
+
|
| 98 |
+
transforms: ${scratch.video_transforms_val}
|
| 99 |
+
max_ann_per_img: 100000 # filtered in transforms
|
| 100 |
+
max_val_queries: 100000
|
| 101 |
+
multiplier: 1
|
| 102 |
+
load_segmentation: true
|
| 103 |
+
training: false
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
shuffle: False
|
| 107 |
+
batch_size: ${scratch.val_batch_size}
|
| 108 |
+
num_workers: ${scratch.num_val_workers}
|
| 109 |
+
pin_memory: True
|
| 110 |
+
drop_last: False
|
| 111 |
+
collate_fn:
|
| 112 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 113 |
+
_partial_: true
|
| 114 |
+
repeats: ${scratch.hybrid_repeats}
|
| 115 |
+
dict_key: ytvis_val
|
| 116 |
+
with_seg_masks: true
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
model:
|
| 120 |
+
_target_: sam3.model_builder.build_sam3_video_model
|
| 121 |
+
bpe_path: ${paths.bpe_path}
|
| 122 |
+
has_presence_token: True
|
| 123 |
+
geo_encoder_use_img_cross_attn: True
|
| 124 |
+
apply_temporal_disambiguation: False
|
| 125 |
+
|
| 126 |
+
meters:
|
| 127 |
+
val:
|
| 128 |
+
ytvis_val:
|
| 129 |
+
pred_file: # key
|
| 130 |
+
_target_: sam3.eval.ytvis_eval.YTVISResultsWriter
|
| 131 |
+
dump_file: ${launcher.experiment_log_dir}/preds/${paths.dump_file_name}.json
|
| 132 |
+
postprocessor: ${scratch.vid_mask_postprocessor}
|
| 133 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 134 |
+
|
| 135 |
+
optim:
|
| 136 |
+
amp:
|
| 137 |
+
enabled: True
|
| 138 |
+
amp_dtype: bfloat16
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
checkpoint:
|
| 142 |
+
save_dir: ${launcher.experiment_log_dir}/checkpoints
|
| 143 |
+
save_freq: 0 # 0 only last checkpoint is saved.
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
logging:
|
| 147 |
+
tensorboard_writer:
|
| 148 |
+
_target_: sam3.train.utils.logger.make_tensorboard_logger
|
| 149 |
+
log_dir: ${launcher.experiment_log_dir}/tensorboard
|
| 150 |
+
flush_secs: 120
|
| 151 |
+
should_log: True
|
| 152 |
+
wandb_writer: null
|
| 153 |
+
log_dir: ${launcher.experiment_log_dir}/logs/
|
| 154 |
+
log_freq: 10
|
| 155 |
+
|
| 156 |
+
# ============================================================================
|
| 157 |
+
# Launcher and Submitit Configuration
|
| 158 |
+
# ============================================================================
|
| 159 |
+
|
| 160 |
+
launcher:
|
| 161 |
+
num_nodes: 8
|
| 162 |
+
gpus_per_node: 8
|
| 163 |
+
experiment_log_dir: ${paths.experiment_log_dir}
|
| 164 |
+
multiprocessing_context: forkserver
|
| 165 |
+
|
| 166 |
+
submitit:
|
| 167 |
+
account: null
|
| 168 |
+
partition: null
|
| 169 |
+
qos: null
|
| 170 |
+
timeout_hour: 72
|
| 171 |
+
use_cluster: True
|
| 172 |
+
cpus_per_task: 10
|
| 173 |
+
port_range: [10000, 65000]
|
| 174 |
+
constraint: null
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_bdd100k.yaml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- /configs/eval_base.yaml
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
# ============================================================================
|
| 7 |
+
# Paths Configuration (you can override here, but it shouldn't require further changes if eval_base.yaml is correct
|
| 8 |
+
# ============================================================================
|
| 9 |
+
paths:
|
| 10 |
+
experiment_log_dir: ${paths.base_experiment_log_dir}/silver_bdd100k/
|
| 11 |
+
coco_gt: ${paths.base_annotation_path_silver}/silver_bdd100k_merged_test.json
|
| 12 |
+
img_path: ${paths.silver_img_path}/bdd100k/
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ============================================================================
|
| 17 |
+
# Trainer Configuration
|
| 18 |
+
# ============================================================================
|
| 19 |
+
|
| 20 |
+
trainer:
|
| 21 |
+
data:
|
| 22 |
+
val:
|
| 23 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 24 |
+
dataset:
|
| 25 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 26 |
+
coco_json_loader:
|
| 27 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_EVAL_API_FROM_JSON_NP
|
| 28 |
+
_partial_: true
|
| 29 |
+
img_folder: ${paths.img_path}
|
| 30 |
+
ann_file: ${paths.coco_gt}
|
| 31 |
+
transforms: ${scratch.base_val_transform}
|
| 32 |
+
max_ann_per_img: 100000
|
| 33 |
+
multiplier: 1
|
| 34 |
+
training: false
|
| 35 |
+
|
| 36 |
+
shuffle: False
|
| 37 |
+
batch_size: ${scratch.val_batch_size}
|
| 38 |
+
num_workers: ${scratch.num_val_workers}
|
| 39 |
+
pin_memory: False
|
| 40 |
+
drop_last: False
|
| 41 |
+
collate_fn:
|
| 42 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 43 |
+
_partial_: true
|
| 44 |
+
repeats: ${scratch.hybrid_repeats}
|
| 45 |
+
dict_key: silver_bdd100k
|
| 46 |
+
|
| 47 |
+
meters:
|
| 48 |
+
val:
|
| 49 |
+
silver_bdd100k: # this key matches the "dict_key" in the dataloader's collate function
|
| 50 |
+
cgf1:
|
| 51 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 52 |
+
iou_type: "segm"
|
| 53 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/silver_bdd100k
|
| 54 |
+
merge_predictions: True
|
| 55 |
+
postprocessor: ${scratch.mask_postprocessor_thresholded}
|
| 56 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 57 |
+
maxdets: 1000000 # no limit
|
| 58 |
+
pred_file_evaluators:
|
| 59 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 60 |
+
gt_path: ${paths.coco_gt}
|
| 61 |
+
iou_type: "bbox"
|
| 62 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 63 |
+
gt_path: ${paths.coco_gt}
|
| 64 |
+
iou_type: "segm"
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_droid.yaml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- /configs/eval_base.yaml
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
# ============================================================================
|
| 7 |
+
# Paths Configuration (you can override here, but it shouldn't require further changes if eval_base.yaml is correct
|
| 8 |
+
# ============================================================================
|
| 9 |
+
paths:
|
| 10 |
+
experiment_log_dir: ${paths.base_experiment_log_dir}/silver_droid/
|
| 11 |
+
coco_gt: ${paths.base_annotation_path_silver}/silver_droid_merged_test.json
|
| 12 |
+
img_path: ${paths.silver_img_path}/droid/
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ============================================================================
|
| 17 |
+
# Trainer Configuration
|
| 18 |
+
# ============================================================================
|
| 19 |
+
|
| 20 |
+
trainer:
|
| 21 |
+
data:
|
| 22 |
+
val:
|
| 23 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 24 |
+
dataset:
|
| 25 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 26 |
+
coco_json_loader:
|
| 27 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_EVAL_API_FROM_JSON_NP
|
| 28 |
+
_partial_: true
|
| 29 |
+
img_folder: ${paths.img_path}
|
| 30 |
+
ann_file: ${paths.coco_gt}
|
| 31 |
+
transforms: ${scratch.base_val_transform}
|
| 32 |
+
max_ann_per_img: 100000
|
| 33 |
+
multiplier: 1
|
| 34 |
+
training: false
|
| 35 |
+
|
| 36 |
+
shuffle: False
|
| 37 |
+
batch_size: ${scratch.val_batch_size}
|
| 38 |
+
num_workers: ${scratch.num_val_workers}
|
| 39 |
+
pin_memory: False
|
| 40 |
+
drop_last: False
|
| 41 |
+
collate_fn:
|
| 42 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 43 |
+
_partial_: true
|
| 44 |
+
repeats: ${scratch.hybrid_repeats}
|
| 45 |
+
dict_key: silver_droid
|
| 46 |
+
|
| 47 |
+
meters:
|
| 48 |
+
val:
|
| 49 |
+
silver_droid: # this key matches the "dict_key" in the dataloader's collate function
|
| 50 |
+
cgf1:
|
| 51 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 52 |
+
iou_type: "segm"
|
| 53 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/silver_droid
|
| 54 |
+
merge_predictions: True
|
| 55 |
+
postprocessor: ${scratch.mask_postprocessor_thresholded}
|
| 56 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 57 |
+
maxdets: 1000000 # no limit
|
| 58 |
+
pred_file_evaluators:
|
| 59 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 60 |
+
gt_path: ${paths.coco_gt}
|
| 61 |
+
iou_type: "bbox"
|
| 62 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 63 |
+
gt_path: ${paths.coco_gt}
|
| 64 |
+
iou_type: "segm"
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_ego4d.yaml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- /configs/eval_base.yaml
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
# ============================================================================
|
| 7 |
+
# Paths Configuration (you can override here, but it shouldn't require further changes if eval_base.yaml is correct
|
| 8 |
+
# ============================================================================
|
| 9 |
+
paths:
|
| 10 |
+
experiment_log_dir: ${paths.base_experiment_log_dir}/silver_ego4d/
|
| 11 |
+
coco_gt: ${paths.base_annotation_path_silver}/silver_ego4d_merged_test.json
|
| 12 |
+
img_path: ${paths.silver_img_path}/ego4d/
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ============================================================================
|
| 17 |
+
# Trainer Configuration
|
| 18 |
+
# ============================================================================
|
| 19 |
+
|
| 20 |
+
trainer:
|
| 21 |
+
data:
|
| 22 |
+
val:
|
| 23 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 24 |
+
dataset:
|
| 25 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 26 |
+
coco_json_loader:
|
| 27 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_EVAL_API_FROM_JSON_NP
|
| 28 |
+
_partial_: true
|
| 29 |
+
img_folder: ${paths.img_path}
|
| 30 |
+
ann_file: ${paths.coco_gt}
|
| 31 |
+
transforms: ${scratch.base_val_transform}
|
| 32 |
+
max_ann_per_img: 100000
|
| 33 |
+
multiplier: 1
|
| 34 |
+
training: false
|
| 35 |
+
|
| 36 |
+
shuffle: False
|
| 37 |
+
batch_size: ${scratch.val_batch_size}
|
| 38 |
+
num_workers: ${scratch.num_val_workers}
|
| 39 |
+
pin_memory: False
|
| 40 |
+
drop_last: False
|
| 41 |
+
collate_fn:
|
| 42 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 43 |
+
_partial_: true
|
| 44 |
+
repeats: ${scratch.hybrid_repeats}
|
| 45 |
+
dict_key: silver_ego4d
|
| 46 |
+
|
| 47 |
+
meters:
|
| 48 |
+
val:
|
| 49 |
+
silver_ego4d: # this key matches the "dict_key" in the dataloader's collate function
|
| 50 |
+
cgf1:
|
| 51 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 52 |
+
iou_type: "segm"
|
| 53 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/silver_ego4d
|
| 54 |
+
merge_predictions: True
|
| 55 |
+
postprocessor: ${scratch.mask_postprocessor_thresholded}
|
| 56 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 57 |
+
maxdets: 1000000 # no limit
|
| 58 |
+
pred_file_evaluators:
|
| 59 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 60 |
+
gt_path: ${paths.coco_gt}
|
| 61 |
+
iou_type: "bbox"
|
| 62 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 63 |
+
gt_path: ${paths.coco_gt}
|
| 64 |
+
iou_type: "segm"
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_fathomnet.yaml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- /configs/eval_base.yaml
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
# ============================================================================
|
| 7 |
+
# Paths Configuration (you can override here, but it shouldn't require further changes if eval_base.yaml is correct
|
| 8 |
+
# ============================================================================
|
| 9 |
+
paths:
|
| 10 |
+
experiment_log_dir: ${paths.base_experiment_log_dir}/silver_fathomnet/
|
| 11 |
+
coco_gt: ${paths.base_annotation_path_silver}/silver_fathomnet_test.json
|
| 12 |
+
img_path: ${paths.silver_img_path}/fathomnet/
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ============================================================================
|
| 17 |
+
# Trainer Configuration
|
| 18 |
+
# ============================================================================
|
| 19 |
+
|
| 20 |
+
trainer:
|
| 21 |
+
data:
|
| 22 |
+
val:
|
| 23 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 24 |
+
dataset:
|
| 25 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 26 |
+
coco_json_loader:
|
| 27 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_EVAL_API_FROM_JSON_NP
|
| 28 |
+
_partial_: true
|
| 29 |
+
img_folder: ${paths.img_path}
|
| 30 |
+
ann_file: ${paths.coco_gt}
|
| 31 |
+
transforms: ${scratch.base_val_transform}
|
| 32 |
+
max_ann_per_img: 100000
|
| 33 |
+
multiplier: 1
|
| 34 |
+
training: false
|
| 35 |
+
|
| 36 |
+
shuffle: False
|
| 37 |
+
batch_size: ${scratch.val_batch_size}
|
| 38 |
+
num_workers: ${scratch.num_val_workers}
|
| 39 |
+
pin_memory: False
|
| 40 |
+
drop_last: False
|
| 41 |
+
collate_fn:
|
| 42 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 43 |
+
_partial_: true
|
| 44 |
+
repeats: ${scratch.hybrid_repeats}
|
| 45 |
+
dict_key: silver_fathomnet
|
| 46 |
+
|
| 47 |
+
meters:
|
| 48 |
+
val:
|
| 49 |
+
silver_fathomnet: # this key matches the "dict_key" in the dataloader's collate function
|
| 50 |
+
cgf1:
|
| 51 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 52 |
+
iou_type: "segm"
|
| 53 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/silver_fathomnet
|
| 54 |
+
merge_predictions: True
|
| 55 |
+
postprocessor: ${scratch.mask_postprocessor_thresholded}
|
| 56 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 57 |
+
maxdets: 1000000 # no limit
|
| 58 |
+
pred_file_evaluators:
|
| 59 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 60 |
+
gt_path: ${paths.coco_gt}
|
| 61 |
+
iou_type: "bbox"
|
| 62 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 63 |
+
gt_path: ${paths.coco_gt}
|
| 64 |
+
iou_type: "segm"
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_food_rec.yaml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- /configs/eval_base.yaml
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
# ============================================================================
|
| 7 |
+
# Paths Configuration (you can override here, but it shouldn't require further changes if eval_base.yaml is correct
|
| 8 |
+
# ============================================================================
|
| 9 |
+
paths:
|
| 10 |
+
experiment_log_dir: ${paths.base_experiment_log_dir}/silver_food_rec/
|
| 11 |
+
coco_gt: ${paths.base_annotation_path_silver}/silver_food_rec_merged_test.json
|
| 12 |
+
img_path: ${paths.silver_img_path}/food_rec/
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ============================================================================
|
| 17 |
+
# Trainer Configuration
|
| 18 |
+
# ============================================================================
|
| 19 |
+
|
| 20 |
+
trainer:
|
| 21 |
+
data:
|
| 22 |
+
val:
|
| 23 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 24 |
+
dataset:
|
| 25 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 26 |
+
coco_json_loader:
|
| 27 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_EVAL_API_FROM_JSON_NP
|
| 28 |
+
_partial_: true
|
| 29 |
+
img_folder: ${paths.img_path}
|
| 30 |
+
ann_file: ${paths.coco_gt}
|
| 31 |
+
transforms: ${scratch.base_val_transform}
|
| 32 |
+
max_ann_per_img: 100000
|
| 33 |
+
multiplier: 1
|
| 34 |
+
training: false
|
| 35 |
+
|
| 36 |
+
shuffle: False
|
| 37 |
+
batch_size: ${scratch.val_batch_size}
|
| 38 |
+
num_workers: ${scratch.num_val_workers}
|
| 39 |
+
pin_memory: False
|
| 40 |
+
drop_last: False
|
| 41 |
+
collate_fn:
|
| 42 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 43 |
+
_partial_: true
|
| 44 |
+
repeats: ${scratch.hybrid_repeats}
|
| 45 |
+
dict_key: silver_food_rec
|
| 46 |
+
|
| 47 |
+
meters:
|
| 48 |
+
val:
|
| 49 |
+
silver_food_rec: # this key matches the "dict_key" in the dataloader's collate function
|
| 50 |
+
cgf1:
|
| 51 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 52 |
+
iou_type: "segm"
|
| 53 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/silver_food_rec
|
| 54 |
+
merge_predictions: True
|
| 55 |
+
postprocessor: ${scratch.mask_postprocessor_thresholded}
|
| 56 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 57 |
+
maxdets: 1000000 # no limit
|
| 58 |
+
pred_file_evaluators:
|
| 59 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 60 |
+
gt_path: ${paths.coco_gt}
|
| 61 |
+
iou_type: "bbox"
|
| 62 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 63 |
+
gt_path: ${paths.coco_gt}
|
| 64 |
+
iou_type: "segm"
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_geode.yaml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- /configs/eval_base.yaml
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
# ============================================================================
|
| 7 |
+
# Paths Configuration (you can override here, but it shouldn't require further changes if eval_base.yaml is correct
|
| 8 |
+
# ============================================================================
|
| 9 |
+
paths:
|
| 10 |
+
experiment_log_dir: ${paths.base_experiment_log_dir}/silver_geode/
|
| 11 |
+
coco_gt: ${paths.base_annotation_path_silver}/silver_geode_merged_test.json
|
| 12 |
+
img_path: ${paths.silver_img_path}/geode/
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ============================================================================
|
| 17 |
+
# Trainer Configuration
|
| 18 |
+
# ============================================================================
|
| 19 |
+
|
| 20 |
+
trainer:
|
| 21 |
+
data:
|
| 22 |
+
val:
|
| 23 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 24 |
+
dataset:
|
| 25 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 26 |
+
coco_json_loader:
|
| 27 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_EVAL_API_FROM_JSON_NP
|
| 28 |
+
_partial_: true
|
| 29 |
+
img_folder: ${paths.img_path}
|
| 30 |
+
ann_file: ${paths.coco_gt}
|
| 31 |
+
transforms: ${scratch.base_val_transform}
|
| 32 |
+
max_ann_per_img: 100000
|
| 33 |
+
multiplier: 1
|
| 34 |
+
training: false
|
| 35 |
+
|
| 36 |
+
shuffle: False
|
| 37 |
+
batch_size: ${scratch.val_batch_size}
|
| 38 |
+
num_workers: ${scratch.num_val_workers}
|
| 39 |
+
pin_memory: False
|
| 40 |
+
drop_last: False
|
| 41 |
+
collate_fn:
|
| 42 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 43 |
+
_partial_: true
|
| 44 |
+
repeats: ${scratch.hybrid_repeats}
|
| 45 |
+
dict_key: silver_geode
|
| 46 |
+
|
| 47 |
+
meters:
|
| 48 |
+
val:
|
| 49 |
+
silver_geode: # this key matches the "dict_key" in the dataloader's collate function
|
| 50 |
+
cgf1:
|
| 51 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 52 |
+
iou_type: "segm"
|
| 53 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/silver_geode
|
| 54 |
+
merge_predictions: True
|
| 55 |
+
postprocessor: ${scratch.mask_postprocessor_thresholded}
|
| 56 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 57 |
+
maxdets: 1000000 # no limit
|
| 58 |
+
pred_file_evaluators:
|
| 59 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 60 |
+
gt_path: ${paths.coco_gt}
|
| 61 |
+
iou_type: "bbox"
|
| 62 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 63 |
+
gt_path: ${paths.coco_gt}
|
| 64 |
+
iou_type: "segm"
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_inaturalist.yaml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- /configs/eval_base.yaml
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
# ============================================================================
|
| 7 |
+
# Paths Configuration (you can override here, but it shouldn't require further changes if eval_base.yaml is correct
|
| 8 |
+
# ============================================================================
|
| 9 |
+
paths:
|
| 10 |
+
experiment_log_dir: ${paths.base_experiment_log_dir}/silver_inaturalist/
|
| 11 |
+
coco_gt: ${paths.base_annotation_path_silver}/silver_inaturalist_merged_test.json
|
| 12 |
+
img_path: ${paths.silver_img_path}/inaturalist/
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ============================================================================
|
| 17 |
+
# Trainer Configuration
|
| 18 |
+
# ============================================================================
|
| 19 |
+
|
| 20 |
+
trainer:
|
| 21 |
+
data:
|
| 22 |
+
val:
|
| 23 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 24 |
+
dataset:
|
| 25 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 26 |
+
coco_json_loader:
|
| 27 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_EVAL_API_FROM_JSON_NP
|
| 28 |
+
_partial_: true
|
| 29 |
+
img_folder: ${paths.img_path}
|
| 30 |
+
ann_file: ${paths.coco_gt}
|
| 31 |
+
transforms: ${scratch.base_val_transform}
|
| 32 |
+
max_ann_per_img: 100000
|
| 33 |
+
multiplier: 1
|
| 34 |
+
training: false
|
| 35 |
+
|
| 36 |
+
shuffle: False
|
| 37 |
+
batch_size: ${scratch.val_batch_size}
|
| 38 |
+
num_workers: ${scratch.num_val_workers}
|
| 39 |
+
pin_memory: False
|
| 40 |
+
drop_last: False
|
| 41 |
+
collate_fn:
|
| 42 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 43 |
+
_partial_: true
|
| 44 |
+
repeats: ${scratch.hybrid_repeats}
|
| 45 |
+
dict_key: silver_inaturalist
|
| 46 |
+
|
| 47 |
+
meters:
|
| 48 |
+
val:
|
| 49 |
+
silver_inaturalist: # this key matches the "dict_key" in the dataloader's collate function
|
| 50 |
+
cgf1:
|
| 51 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 52 |
+
iou_type: "segm"
|
| 53 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/silver_inaturalist
|
| 54 |
+
merge_predictions: True
|
| 55 |
+
postprocessor: ${scratch.mask_postprocessor_thresholded}
|
| 56 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 57 |
+
maxdets: 1000000 # no limit
|
| 58 |
+
pred_file_evaluators:
|
| 59 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 60 |
+
gt_path: ${paths.coco_gt}
|
| 61 |
+
iou_type: "bbox"
|
| 62 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 63 |
+
gt_path: ${paths.coco_gt}
|
| 64 |
+
iou_type: "segm"
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_nga.yaml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- /configs/eval_base.yaml
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
# ============================================================================
|
| 7 |
+
# Paths Configuration (you can override here, but it shouldn't require further changes if eval_base.yaml is correct
|
| 8 |
+
# ============================================================================
|
| 9 |
+
paths:
|
| 10 |
+
experiment_log_dir: ${paths.base_experiment_log_dir}/silver_nga_art/
|
| 11 |
+
coco_gt: ${paths.base_annotation_path_silver}/silver_nga_art_merged_test.json
|
| 12 |
+
img_path: ${paths.silver_img_path}/nga/
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ============================================================================
|
| 17 |
+
# Trainer Configuration
|
| 18 |
+
# ============================================================================
|
| 19 |
+
|
| 20 |
+
trainer:
|
| 21 |
+
data:
|
| 22 |
+
val:
|
| 23 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 24 |
+
dataset:
|
| 25 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 26 |
+
coco_json_loader:
|
| 27 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_EVAL_API_FROM_JSON_NP
|
| 28 |
+
_partial_: true
|
| 29 |
+
img_folder: ${paths.img_path}
|
| 30 |
+
ann_file: ${paths.coco_gt}
|
| 31 |
+
transforms: ${scratch.base_val_transform}
|
| 32 |
+
max_ann_per_img: 100000
|
| 33 |
+
multiplier: 1
|
| 34 |
+
training: false
|
| 35 |
+
|
| 36 |
+
shuffle: False
|
| 37 |
+
batch_size: ${scratch.val_batch_size}
|
| 38 |
+
num_workers: ${scratch.num_val_workers}
|
| 39 |
+
pin_memory: False
|
| 40 |
+
drop_last: False
|
| 41 |
+
collate_fn:
|
| 42 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 43 |
+
_partial_: true
|
| 44 |
+
repeats: ${scratch.hybrid_repeats}
|
| 45 |
+
dict_key: silver_nga_art
|
| 46 |
+
|
| 47 |
+
meters:
|
| 48 |
+
val:
|
| 49 |
+
silver_nga_art: # this key matches the "dict_key" in the dataloader's collate function
|
| 50 |
+
cgf1:
|
| 51 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 52 |
+
iou_type: "segm"
|
| 53 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/silver_nga_art
|
| 54 |
+
merge_predictions: True
|
| 55 |
+
postprocessor: ${scratch.mask_postprocessor_thresholded}
|
| 56 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 57 |
+
maxdets: 1000000 # no limit
|
| 58 |
+
pred_file_evaluators:
|
| 59 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 60 |
+
gt_path: ${paths.coco_gt}
|
| 61 |
+
iou_type: "bbox"
|
| 62 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 63 |
+
gt_path: ${paths.coco_gt}
|
| 64 |
+
iou_type: "segm"
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_sav.yaml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- /configs/eval_base.yaml
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
# ============================================================================
|
| 7 |
+
# Paths Configuration (you can override here, but it shouldn't require further changes if eval_base.yaml is correct
|
| 8 |
+
# ============================================================================
|
| 9 |
+
paths:
|
| 10 |
+
experiment_log_dir: ${paths.base_experiment_log_dir}/silver_sav/
|
| 11 |
+
coco_gt: ${paths.base_annotation_path_silver}/silver_sav_merged_test.json
|
| 12 |
+
img_path: ${paths.silver_img_path}/sav/
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ============================================================================
|
| 17 |
+
# Trainer Configuration
|
| 18 |
+
# ============================================================================
|
| 19 |
+
|
| 20 |
+
trainer:
|
| 21 |
+
data:
|
| 22 |
+
val:
|
| 23 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 24 |
+
dataset:
|
| 25 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 26 |
+
coco_json_loader:
|
| 27 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_EVAL_API_FROM_JSON_NP
|
| 28 |
+
_partial_: true
|
| 29 |
+
img_folder: ${paths.img_path}
|
| 30 |
+
ann_file: ${paths.coco_gt}
|
| 31 |
+
transforms: ${scratch.base_val_transform}
|
| 32 |
+
max_ann_per_img: 100000
|
| 33 |
+
multiplier: 1
|
| 34 |
+
training: false
|
| 35 |
+
|
| 36 |
+
shuffle: False
|
| 37 |
+
batch_size: ${scratch.val_batch_size}
|
| 38 |
+
num_workers: ${scratch.num_val_workers}
|
| 39 |
+
pin_memory: False
|
| 40 |
+
drop_last: False
|
| 41 |
+
collate_fn:
|
| 42 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 43 |
+
_partial_: true
|
| 44 |
+
repeats: ${scratch.hybrid_repeats}
|
| 45 |
+
dict_key: silver_sav
|
| 46 |
+
|
| 47 |
+
meters:
|
| 48 |
+
val:
|
| 49 |
+
silver_sav: # this key matches the "dict_key" in the dataloader's collate function
|
| 50 |
+
cgf1:
|
| 51 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 52 |
+
iou_type: "segm"
|
| 53 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/silver_sav
|
| 54 |
+
merge_predictions: True
|
| 55 |
+
postprocessor: ${scratch.mask_postprocessor_thresholded}
|
| 56 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 57 |
+
maxdets: 1000000 # no limit
|
| 58 |
+
pred_file_evaluators:
|
| 59 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 60 |
+
gt_path: ${paths.coco_gt}
|
| 61 |
+
iou_type: "bbox"
|
| 62 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 63 |
+
gt_path: ${paths.coco_gt}
|
| 64 |
+
iou_type: "segm"
|
之前的代码版本/注意力用于sam的prompt的版本/HuatuoGPT-Vision/MedSAM3/sam3/train/configs/silver_image_evals/sam3_silver_image_yt1b.yaml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- /configs/eval_base.yaml
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
# ============================================================================
|
| 7 |
+
# Paths Configuration (you can override here, but it shouldn't require further changes if eval_base.yaml is correct
|
| 8 |
+
# ============================================================================
|
| 9 |
+
paths:
|
| 10 |
+
experiment_log_dir: ${paths.base_experiment_log_dir}/silver_yt1b/
|
| 11 |
+
coco_gt: ${paths.base_annotation_path_silver}/silver_yt1b_merged_test.json
|
| 12 |
+
img_path: ${paths.silver_img_path}/yt1b/
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ============================================================================
|
| 17 |
+
# Trainer Configuration
|
| 18 |
+
# ============================================================================
|
| 19 |
+
|
| 20 |
+
trainer:
|
| 21 |
+
data:
|
| 22 |
+
val:
|
| 23 |
+
_target_: sam3.train.data.torch_dataset.TorchDataset
|
| 24 |
+
dataset:
|
| 25 |
+
_target_: sam3.train.data.sam3_image_dataset.Sam3ImageDataset
|
| 26 |
+
coco_json_loader:
|
| 27 |
+
_target_: sam3.train.data.coco_json_loaders.SAM3_EVAL_API_FROM_JSON_NP
|
| 28 |
+
_partial_: true
|
| 29 |
+
img_folder: ${paths.img_path}
|
| 30 |
+
ann_file: ${paths.coco_gt}
|
| 31 |
+
transforms: ${scratch.base_val_transform}
|
| 32 |
+
max_ann_per_img: 100000
|
| 33 |
+
multiplier: 1
|
| 34 |
+
training: false
|
| 35 |
+
|
| 36 |
+
shuffle: False
|
| 37 |
+
batch_size: ${scratch.val_batch_size}
|
| 38 |
+
num_workers: ${scratch.num_val_workers}
|
| 39 |
+
pin_memory: False
|
| 40 |
+
drop_last: False
|
| 41 |
+
collate_fn:
|
| 42 |
+
_target_: sam3.train.data.collator.collate_fn_api
|
| 43 |
+
_partial_: true
|
| 44 |
+
repeats: ${scratch.hybrid_repeats}
|
| 45 |
+
dict_key: silver_yt1b
|
| 46 |
+
|
| 47 |
+
meters:
|
| 48 |
+
val:
|
| 49 |
+
silver_yt1b: # this key matches the "dict_key" in the dataloader's collate function
|
| 50 |
+
cgf1:
|
| 51 |
+
_target_: sam3.eval.coco_writer.PredictionDumper
|
| 52 |
+
iou_type: "segm"
|
| 53 |
+
dump_dir: ${launcher.experiment_log_dir}/dumps/silver_yt1b
|
| 54 |
+
merge_predictions: True
|
| 55 |
+
postprocessor: ${scratch.mask_postprocessor_thresholded}
|
| 56 |
+
gather_pred_via_filesys: ${scratch.gather_pred_via_filesys}
|
| 57 |
+
maxdets: 1000000 # no limit
|
| 58 |
+
pred_file_evaluators:
|
| 59 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 60 |
+
gt_path: ${paths.coco_gt}
|
| 61 |
+
iou_type: "bbox"
|
| 62 |
+
- _target_: sam3.eval.cgf1_eval.CGF1Evaluator
|
| 63 |
+
gt_path: ${paths.coco_gt}
|
| 64 |
+
iou_type: "segm"
|