aliasz commited on
Commit
805d339
·
verified ·
1 Parent(s): 6ab98e7

Uploaded StomataPy400K model weights

Browse files
StomataPy400K_aperture_512/dinov2_segmentor.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:75fd8b50765fd3daf3c0369a6972a36ba98790e1d2986b4b81b4e9e6c4495095
3
+ size 1428156285
StomataPy400K_aperture_512/seg_rein_dinov2_mask2former.py ADDED
@@ -0,0 +1,651 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ReduceOnPlateauLR_patience = 50
2
+ albu_train_transforms = [
3
+ dict(
4
+ always_apply=True,
5
+ border_mode=0,
6
+ min_height=512,
7
+ min_width=512,
8
+ type='PadIfNeeded'),
9
+ dict(always_apply=True, type='Flip'),
10
+ dict(
11
+ always_apply=True, interpolation=4, limit=(
12
+ -180,
13
+ 180,
14
+ ), type='Rotate'),
15
+ dict(
16
+ p=0.5,
17
+ transforms=[
18
+ dict(
19
+ alpha=20,
20
+ approximate=True,
21
+ border_mode=0,
22
+ interpolation=4,
23
+ mask_value=(
24
+ 0,
25
+ 0,
26
+ 0,
27
+ ),
28
+ p=0.5,
29
+ same_dxdy=True,
30
+ sigma=15,
31
+ type='ElasticTransform'),
32
+ dict(
33
+ alpha=40,
34
+ approximate=True,
35
+ border_mode=0,
36
+ interpolation=4,
37
+ mask_value=(
38
+ 0,
39
+ 0,
40
+ 0,
41
+ ),
42
+ p=0.5,
43
+ same_dxdy=False,
44
+ sigma=15,
45
+ type='ElasticTransform'),
46
+ ],
47
+ type='OneOf'),
48
+ dict(
49
+ always_apply=True,
50
+ brightness=0.2,
51
+ contrast=0.1,
52
+ hue=0.2,
53
+ saturation=0.2,
54
+ type='ColorJitter'),
55
+ dict(p=0.5, type='AdvancedBlur'),
56
+ dict(always_apply=True, height=512, type='CenterCrop', width=512),
57
+ ]
58
+ auto_scale_lr = dict(base_batch_size=16, enable=False)
59
+ batch_size = 8
60
+ class_weight = [
61
+ 1.0,
62
+ 1.0,
63
+ 1.0,
64
+ 1.0,
65
+ 1.0,
66
+ 1.0,
67
+ 0.1,
68
+ ]
69
+ classes = (
70
+ 'background',
71
+ 'stomatal complex',
72
+ 'stoma',
73
+ 'outer ledge',
74
+ 'pore',
75
+ 'pavement cell',
76
+ )
77
+ crop_size = (
78
+ 512,
79
+ 512,
80
+ )
81
+ data_root = 'StomataPy400K_filtered_train/'
82
+ dataset_type = 'StomataDataset'
83
+ default_hooks = dict(
84
+ checkpoint=dict(
85
+ by_epoch=True,
86
+ interval=999999,
87
+ save_best='mIoU',
88
+ save_last=True,
89
+ type='CheckpointHook'),
90
+ early_stopping=dict(
91
+ monitor='mIoU', patience=150, rule='greater',
92
+ type='EarlyStoppingHook'),
93
+ logger=dict(interval=600, log_metric_by_epoch=True, type='LoggerHook'),
94
+ param_scheduler=dict(type='ParamSchedulerHook'),
95
+ sampler_seed=dict(type='DistSamplerSeedHook'),
96
+ timer=dict(type='IterTimerHook'),
97
+ visualization=dict(draw=True, interval=50, type='SegVisualizationHook'))
98
+ default_scope = 'mmseg'
99
+ dinov2_checkpoint = 'train/checkpoints/dinov2_converted.pth'
100
+ early_stopping_patience = 150
101
+ env_cfg = dict(
102
+ cudnn_benchmark=True,
103
+ dist_cfg=dict(backend='nccl'),
104
+ mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0))
105
+ find_unused_parameters = True
106
+ fp16 = dict(loss_scale='dynamic')
107
+ launcher = 'pytorch'
108
+ load_from = None
109
+ log_level = 'INFO'
110
+ log_processor = dict(by_epoch=True)
111
+ lr = 1e-05
112
+ max_epochs = 300
113
+ model = dict(
114
+ backbone=dict(
115
+ block_chunks=0,
116
+ depth=24,
117
+ embed_dim=1024,
118
+ ffn_bias=True,
119
+ ffn_layer='mlp',
120
+ img_size=512,
121
+ init_cfg=dict(
122
+ checkpoint='train/checkpoints/dinov2_converted.pth',
123
+ type='Pretrained'),
124
+ init_values=1e-05,
125
+ mlp_ratio=4,
126
+ num_heads=16,
127
+ patch_size=16,
128
+ proj_bias=True,
129
+ qkv_bias=True,
130
+ reins_config=dict(
131
+ embed_dims=1024,
132
+ link_token_to_query=True,
133
+ lora_dim=16,
134
+ num_layers=24,
135
+ patch_size=16,
136
+ token_length=100,
137
+ type='LoRAReins'),
138
+ type='ReinsDinoVisionTransformer'),
139
+ data_preprocessor=dict(
140
+ bgr_to_rgb=True,
141
+ mean=[
142
+ 123.675,
143
+ 116.28,
144
+ 103.53,
145
+ ],
146
+ pad_val=0,
147
+ seg_pad_val=255,
148
+ size=(
149
+ 512,
150
+ 512,
151
+ ),
152
+ std=[
153
+ 58.395,
154
+ 57.12,
155
+ 57.375,
156
+ ],
157
+ type='SegDataPreProcessor'),
158
+ decode_head=dict(
159
+ align_corners=False,
160
+ enforce_decoder_input_project=False,
161
+ feat_channels=256,
162
+ in_channels=[
163
+ 1024,
164
+ 1024,
165
+ 1024,
166
+ 1024,
167
+ ],
168
+ loss_cls=dict(
169
+ class_weight=[
170
+ 1.0,
171
+ 1.0,
172
+ 1.0,
173
+ 1.0,
174
+ 1.0,
175
+ 1.0,
176
+ 0.1,
177
+ ],
178
+ loss_weight=2.0,
179
+ reduction='mean',
180
+ type='mmdet.CrossEntropyLoss',
181
+ use_sigmoid=False),
182
+ loss_dice=dict(
183
+ activate=True,
184
+ eps=1.0,
185
+ loss_weight=5.0,
186
+ naive_dice=True,
187
+ reduction='mean',
188
+ type='mmdet.DiceLoss',
189
+ use_sigmoid=True),
190
+ loss_mask=dict(
191
+ loss_weight=5.0,
192
+ reduction='mean',
193
+ type='mmdet.CrossEntropyLoss',
194
+ use_sigmoid=True),
195
+ num_classes=6,
196
+ num_queries=100,
197
+ num_transformer_feat_level=3,
198
+ out_channels=256,
199
+ pixel_decoder=dict(
200
+ act_cfg=dict(type='ReLU'),
201
+ encoder=dict(
202
+ init_cfg=None,
203
+ layer_cfg=dict(
204
+ ffn_cfg=dict(
205
+ act_cfg=dict(inplace=True, type='ReLU'),
206
+ embed_dims=256,
207
+ feedforward_channels=1024,
208
+ ffn_drop=0.0,
209
+ num_fcs=2),
210
+ self_attn_cfg=dict(
211
+ batch_first=True,
212
+ dropout=0.0,
213
+ embed_dims=256,
214
+ im2col_step=64,
215
+ init_cfg=None,
216
+ norm_cfg=None,
217
+ num_heads=8,
218
+ num_levels=3,
219
+ num_points=4)),
220
+ num_layers=6),
221
+ init_cfg=None,
222
+ norm_cfg=dict(num_groups=32, type='GN'),
223
+ num_outs=3,
224
+ positional_encoding=dict(normalize=True, num_feats=128),
225
+ type='mmdet.MSDeformAttnPixelDecoder'),
226
+ positional_encoding=dict(normalize=True, num_feats=128),
227
+ replace_query_feat=True,
228
+ strides=[
229
+ 4,
230
+ 8,
231
+ 16,
232
+ 32,
233
+ ],
234
+ train_cfg=dict(
235
+ assigner=dict(
236
+ match_costs=[
237
+ dict(type='mmdet.ClassificationCost', weight=2.0),
238
+ dict(
239
+ type='mmdet.CrossEntropyLossCost',
240
+ use_sigmoid=True,
241
+ weight=5.0),
242
+ dict(
243
+ eps=1.0,
244
+ pred_act=True,
245
+ type='mmdet.DiceCost',
246
+ weight=5.0),
247
+ ],
248
+ type='mmdet.HungarianAssigner'),
249
+ importance_sample_ratio=0.75,
250
+ num_points=12544,
251
+ oversample_ratio=3.0,
252
+ sampler=dict(type='mmdet.MaskPseudoSampler')),
253
+ transformer_decoder=dict(
254
+ init_cfg=None,
255
+ layer_cfg=dict(
256
+ cross_attn_cfg=dict(
257
+ attn_drop=0.0,
258
+ batch_first=True,
259
+ dropout_layer=None,
260
+ embed_dims=256,
261
+ num_heads=8,
262
+ proj_drop=0.0),
263
+ ffn_cfg=dict(
264
+ act_cfg=dict(inplace=True, type='ReLU'),
265
+ add_identity=True,
266
+ dropout_layer=None,
267
+ embed_dims=256,
268
+ feedforward_channels=2048,
269
+ ffn_drop=0.0,
270
+ num_fcs=2),
271
+ self_attn_cfg=dict(
272
+ attn_drop=0.0,
273
+ batch_first=True,
274
+ dropout_layer=None,
275
+ embed_dims=256,
276
+ num_heads=8,
277
+ proj_drop=0.0)),
278
+ num_layers=9,
279
+ return_intermediate=True),
280
+ type='ReinMask2FormerHead'),
281
+ test_cfg=dict(crop_size=(
282
+ 512,
283
+ 512,
284
+ ), mode='slide', stride=(
285
+ 1364,
286
+ 1364,
287
+ )),
288
+ train_cfg=dict(),
289
+ type='EncoderDecoder')
290
+ model_crop_size = (
291
+ 512,
292
+ 512,
293
+ )
294
+ n_gpus = 4
295
+ num_classes = 6
296
+ num_workers = 16
297
+ optim_wrapper = dict(
298
+ constructor='PEFTOptimWrapperConstructor',
299
+ optimizer=dict(
300
+ betas=(
301
+ 0.9,
302
+ 0.999,
303
+ ),
304
+ eps=1e-08,
305
+ lr=1e-05,
306
+ type='AdamW',
307
+ weight_decay=0.05),
308
+ paramwise_cfg=dict(
309
+ custom_keys=dict({
310
+ 'learnable_tokens': dict(decay_mult=0.0, lr_mult=1.0),
311
+ 'level_embed': dict(decay_mult=0.0, lr_mult=1.0),
312
+ 'norm': dict(decay_mult=0.0),
313
+ 'query_embed': dict(decay_mult=0.0, lr_mult=1.0),
314
+ 'reins.scale': dict(decay_mult=0.0, lr_mult=1.0)
315
+ }),
316
+ norm_decay_mult=0.0))
317
+ optimizer_config = dict(
318
+ cumulative_iters=8, type='GradientCumulativeOptimizerHook')
319
+ original_batch_size = 4
320
+ original_lr = 0.0001
321
+ original_n_gpus = 8
322
+ output_dir = 'StomataPy400K_aperture_512'
323
+ param_scheduler = [
324
+ dict(
325
+ begin=0,
326
+ by_epoch=True,
327
+ convert_to_iter_based=True,
328
+ end=30,
329
+ end_factor=1.0,
330
+ start_factor=0.001,
331
+ type='LinearLR',
332
+ verbose=False),
333
+ dict(
334
+ T_max=270,
335
+ begin=30,
336
+ by_epoch=True,
337
+ convert_to_iter_based=True,
338
+ end=300,
339
+ eta_min=1.0000000000000002e-10,
340
+ eta_min_ratio=None,
341
+ type='CosineAnnealingLR',
342
+ verbose=False),
343
+ dict(
344
+ by_epoch=True,
345
+ factor=0.75,
346
+ monitor='mIoU',
347
+ patience=50,
348
+ rule='greater',
349
+ type='ReduceOnPlateauLR',
350
+ verbose=False),
351
+ ]
352
+ randomness = dict(deterministic=False, seed=42)
353
+ resume = False
354
+ test_cfg = dict(type='ValLoop')
355
+ test_dataloader = dict(
356
+ batch_size=1,
357
+ dataset=dict(
358
+ ann_file='splits//val.txt',
359
+ data_prefix=dict(img_path='images', seg_map_path='labels'),
360
+ data_root='StomataPy400K_filtered_train/',
361
+ pipeline=[
362
+ dict(type='LoadImageFromFile'),
363
+ dict(prob=0.5, type='RandomFlip'),
364
+ dict(keep_ratio=False, scale=(
365
+ 512,
366
+ 512,
367
+ ), type='Resize'),
368
+ dict(reduce_zero_label=False, type='LoadAnnotations'),
369
+ dict(type='PackSegInputs'),
370
+ ],
371
+ type='StomataDataset'),
372
+ num_workers=16)
373
+ test_evaluator = dict(
374
+ iou_metrics=[
375
+ 'mIoU',
376
+ ], type='IoUMetric')
377
+ test_pipeline = [
378
+ dict(type='LoadImageFromFile'),
379
+ dict(prob=0.5, type='RandomFlip'),
380
+ dict(keep_ratio=False, scale=(
381
+ 512,
382
+ 512,
383
+ ), type='Resize'),
384
+ dict(reduce_zero_label=False, type='LoadAnnotations'),
385
+ dict(type='PackSegInputs'),
386
+ ]
387
+ train_cfg = dict(max_epochs=300, type='EpochBasedTrainLoop', val_interval=1)
388
+ train_dataloader = dict(
389
+ batch_size=8,
390
+ dataset=dict(
391
+ ann_file='splits//train.txt',
392
+ data_prefix=dict(img_path='images', seg_map_path='labels'),
393
+ data_root='StomataPy400K_filtered_train/',
394
+ pipeline=[
395
+ dict(type='LoadImageFromFile'),
396
+ dict(reduce_zero_label=False, type='LoadAnnotations'),
397
+ dict(
398
+ max_size=2048,
399
+ resize_type='ResizeShortestEdge',
400
+ scales=[
401
+ 358,
402
+ 409,
403
+ 460,
404
+ 512,
405
+ 563,
406
+ 614,
407
+ 665,
408
+ 716,
409
+ ],
410
+ type='RandomChoiceResize'),
411
+ dict(
412
+ cat_max_ratio=0.75, crop_size=(
413
+ 512,
414
+ 512,
415
+ ), type='RandomCrop'),
416
+ dict(
417
+ keymap=dict(gt_seg_map='mask', img='image'),
418
+ transforms=[
419
+ dict(
420
+ always_apply=True,
421
+ border_mode=0,
422
+ min_height=512,
423
+ min_width=512,
424
+ type='PadIfNeeded'),
425
+ dict(always_apply=True, type='Flip'),
426
+ dict(
427
+ always_apply=True,
428
+ interpolation=4,
429
+ limit=(
430
+ -180,
431
+ 180,
432
+ ),
433
+ type='Rotate'),
434
+ dict(
435
+ p=0.5,
436
+ transforms=[
437
+ dict(
438
+ alpha=20,
439
+ approximate=True,
440
+ border_mode=0,
441
+ interpolation=4,
442
+ mask_value=(
443
+ 0,
444
+ 0,
445
+ 0,
446
+ ),
447
+ p=0.5,
448
+ same_dxdy=True,
449
+ sigma=15,
450
+ type='ElasticTransform'),
451
+ dict(
452
+ alpha=40,
453
+ approximate=True,
454
+ border_mode=0,
455
+ interpolation=4,
456
+ mask_value=(
457
+ 0,
458
+ 0,
459
+ 0,
460
+ ),
461
+ p=0.5,
462
+ same_dxdy=False,
463
+ sigma=15,
464
+ type='ElasticTransform'),
465
+ ],
466
+ type='OneOf'),
467
+ dict(
468
+ always_apply=True,
469
+ brightness=0.2,
470
+ contrast=0.1,
471
+ hue=0.2,
472
+ saturation=0.2,
473
+ type='ColorJitter'),
474
+ dict(p=0.5, type='AdvancedBlur'),
475
+ dict(
476
+ always_apply=True,
477
+ height=512,
478
+ type='CenterCrop',
479
+ width=512),
480
+ ],
481
+ type='Albu'),
482
+ dict(
483
+ cutout_ratio=(
484
+ 0.02,
485
+ 0.05,
486
+ ),
487
+ n_holes=10,
488
+ prob=0.5,
489
+ type='RandomCutOut'),
490
+ dict(
491
+ interpolation='lanczos',
492
+ keep_ratio=True,
493
+ scale=(
494
+ 512,
495
+ 512,
496
+ ),
497
+ type='Resize'),
498
+ dict(
499
+ meta_keys=(
500
+ 'img_path',
501
+ 'img_shape',
502
+ 'img',
503
+ 'gt_seg_map',
504
+ ),
505
+ type='PackSegInputs'),
506
+ ],
507
+ type='StomataDataset'),
508
+ num_workers=16)
509
+ train_pipeline = [
510
+ dict(type='LoadImageFromFile'),
511
+ dict(reduce_zero_label=False, type='LoadAnnotations'),
512
+ dict(
513
+ max_size=2048,
514
+ resize_type='ResizeShortestEdge',
515
+ scales=[
516
+ 358,
517
+ 409,
518
+ 460,
519
+ 512,
520
+ 563,
521
+ 614,
522
+ 665,
523
+ 716,
524
+ ],
525
+ type='RandomChoiceResize'),
526
+ dict(cat_max_ratio=0.75, crop_size=(
527
+ 512,
528
+ 512,
529
+ ), type='RandomCrop'),
530
+ dict(
531
+ keymap=dict(gt_seg_map='mask', img='image'),
532
+ transforms=[
533
+ dict(
534
+ always_apply=True,
535
+ border_mode=0,
536
+ min_height=512,
537
+ min_width=512,
538
+ type='PadIfNeeded'),
539
+ dict(always_apply=True, type='Flip'),
540
+ dict(
541
+ always_apply=True,
542
+ interpolation=4,
543
+ limit=(
544
+ -180,
545
+ 180,
546
+ ),
547
+ type='Rotate'),
548
+ dict(
549
+ p=0.5,
550
+ transforms=[
551
+ dict(
552
+ alpha=20,
553
+ approximate=True,
554
+ border_mode=0,
555
+ interpolation=4,
556
+ mask_value=(
557
+ 0,
558
+ 0,
559
+ 0,
560
+ ),
561
+ p=0.5,
562
+ same_dxdy=True,
563
+ sigma=15,
564
+ type='ElasticTransform'),
565
+ dict(
566
+ alpha=40,
567
+ approximate=True,
568
+ border_mode=0,
569
+ interpolation=4,
570
+ mask_value=(
571
+ 0,
572
+ 0,
573
+ 0,
574
+ ),
575
+ p=0.5,
576
+ same_dxdy=False,
577
+ sigma=15,
578
+ type='ElasticTransform'),
579
+ ],
580
+ type='OneOf'),
581
+ dict(
582
+ always_apply=True,
583
+ brightness=0.2,
584
+ contrast=0.1,
585
+ hue=0.2,
586
+ saturation=0.2,
587
+ type='ColorJitter'),
588
+ dict(p=0.5, type='AdvancedBlur'),
589
+ dict(always_apply=True, height=512, type='CenterCrop', width=512),
590
+ ],
591
+ type='Albu'),
592
+ dict(
593
+ cutout_ratio=(
594
+ 0.02,
595
+ 0.05,
596
+ ), n_holes=10, prob=0.5, type='RandomCutOut'),
597
+ dict(
598
+ interpolation='lanczos',
599
+ keep_ratio=True,
600
+ scale=(
601
+ 512,
602
+ 512,
603
+ ),
604
+ type='Resize'),
605
+ dict(
606
+ meta_keys=(
607
+ 'img_path',
608
+ 'img_shape',
609
+ 'img',
610
+ 'gt_seg_map',
611
+ ),
612
+ type='PackSegInputs'),
613
+ ]
614
+ tta_model = dict(type='SegTTAModel')
615
+ val_cfg = dict(type='ValLoop')
616
+ val_dataloader = dict(
617
+ batch_size=1,
618
+ dataset=dict(
619
+ ann_file='splits//val.txt',
620
+ data_prefix=dict(img_path='images', seg_map_path='labels'),
621
+ data_root='StomataPy400K_filtered_train/',
622
+ pipeline=[
623
+ dict(type='LoadImageFromFile'),
624
+ dict(prob=0.5, type='RandomFlip'),
625
+ dict(keep_ratio=False, scale=(
626
+ 512,
627
+ 512,
628
+ ), type='Resize'),
629
+ dict(reduce_zero_label=False, type='LoadAnnotations'),
630
+ dict(type='PackSegInputs'),
631
+ ],
632
+ type='StomataDataset'),
633
+ num_workers=16)
634
+ val_evaluator = dict(
635
+ iou_metrics=[
636
+ 'mIoU',
637
+ ], type='IoUMetric')
638
+ val_interval = 1
639
+ visualizer = dict(
640
+ name='visualizer',
641
+ type='SegLocalVisualizer',
642
+ vis_backends=[
643
+ dict(type='LocalVisBackend'),
644
+ dict(
645
+ init_kwargs=dict(
646
+ name='StomataPy400K_aperture_512', project='StomataPy'),
647
+ type='WandbVisBackend'),
648
+ ])
649
+ wandb_project = 'StomataPy'
650
+ warmup_epochs = 30
651
+ work_dir = '../Models/StomataPy400K_aperture_512'
StomataPy400K_denisty_24185/det_rein_dinov2_mask2former_evensample.py ADDED
@@ -0,0 +1,807 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ReduceOnPlateauLR_patience = 50
2
+ all_datasets = [
3
+ 'ClearStain_Brightfield',
4
+ 'Imprints_Brightfield',
5
+ 'Imprints_DIC',
6
+ 'Leaf_Brightfield',
7
+ 'Leaf_Topometry',
8
+ 'Peels_Brightfield',
9
+ 'Peels_SEM',
10
+ ]
11
+ auto_scale_lr = dict(base_batch_size=16, enable=False)
12
+ batch_augments = [
13
+ dict(
14
+ img_pad_value=0,
15
+ mask_pad_value=0,
16
+ pad_mask=True,
17
+ pad_seg=False,
18
+ seg_pad_value=255,
19
+ size=(
20
+ 512,
21
+ 512,
22
+ ),
23
+ type='BatchFixedSizePad'),
24
+ ]
25
+ batch_size = 2
26
+ classes = ('stomatal complex', )
27
+ crop_size = (
28
+ 1024,
29
+ 768,
30
+ )
31
+ custom_hooks = [
32
+ dict(type='NumClassCheckHook'),
33
+ dict(interval=200, type='MemoryProfilerHook'),
34
+ dict(interval=200, type='CheckInvalidLossHook'),
35
+ dict(type='EMAHook'),
36
+ ]
37
+ custom_imports = dict(
38
+ allow_failed_imports=False, imports=[
39
+ 'mmpretrain.models',
40
+ ])
41
+ data_preprocessor = dict(
42
+ batch_augments=[
43
+ dict(
44
+ img_pad_value=0,
45
+ mask_pad_value=0,
46
+ pad_mask=True,
47
+ pad_seg=False,
48
+ seg_pad_value=255,
49
+ size=(
50
+ 512,
51
+ 512,
52
+ ),
53
+ type='BatchFixedSizePad'),
54
+ ],
55
+ bgr_to_rgb=True,
56
+ mask_pad_value=0,
57
+ mean=[
58
+ 123.675,
59
+ 116.28,
60
+ 103.53,
61
+ ],
62
+ pad_mask=True,
63
+ pad_seg=False,
64
+ pad_size_divisor=32,
65
+ seg_pad_value=255,
66
+ std=[
67
+ 58.395,
68
+ 57.12,
69
+ 57.375,
70
+ ],
71
+ type='DetDataPreprocessor')
72
+ data_root = 'StomataPy400K_train/'
73
+ dataset_type = 'CocoEevenSamplerDataset'
74
+ default_hooks = dict(
75
+ checkpoint=dict(
76
+ by_epoch=True,
77
+ interval=48,
78
+ max_keep_ckpts=5,
79
+ rule='greater',
80
+ save_best='coco/segm_mAP',
81
+ save_last=True,
82
+ type='CheckpointHook'),
83
+ early_stopping=dict(
84
+ monitor='coco/segm_mAP',
85
+ patience=150,
86
+ rule='greater',
87
+ type='EarlyStoppingHook'),
88
+ logger=dict(interval=200, type='LoggerHook'),
89
+ param_scheduler=dict(type='ParamSchedulerHook'),
90
+ sampler_seed=dict(type='DistSamplerSeedHook'),
91
+ timer=dict(type='IterTimerHook'),
92
+ visualization=dict(draw=True, interval=10, type='DetVisualizationHook'))
93
+ default_scope = 'mmdet'
94
+ dinov2_checkpoint = 'train/checkpoints/dinov2_converted.pth'
95
+ early_stopping_patience = 150
96
+ embed_multi = dict(decay_mult=0.0, lr_mult=1.0)
97
+ env_cfg = dict(
98
+ cudnn_benchmark=False,
99
+ dist_cfg=dict(backend='nccl'),
100
+ mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0))
101
+ find_unused_parameters = True
102
+ fp16 = dict(loss_scale='dynamic')
103
+ image_size = (
104
+ 512,
105
+ 512,
106
+ )
107
+ launcher = 'pytorch'
108
+ load_from = None
109
+ load_pipeline = [
110
+ dict(to_float32=True, type='LoadImageFromFile'),
111
+ dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
112
+ dict(prob=0.5, type='RandomFlip'),
113
+ dict(type='PhotoMetricDistortion'),
114
+ dict(
115
+ img_border_value=(
116
+ 0,
117
+ 0,
118
+ 0,
119
+ ),
120
+ interpolation='lanczos',
121
+ prob=0.5,
122
+ type='GeomTransform'),
123
+ dict(keep_ratio=True, scale=(
124
+ 1024,
125
+ 768,
126
+ ), type='Resize'),
127
+ ]
128
+ log_level = 'INFO'
129
+ log_processor = dict(by_epoch=True, type='LogProcessor', window_size=50)
130
+ lr = 9.375e-05
131
+ max_epochs = 240
132
+ model = dict(
133
+ backbone=dict(
134
+ block_chunks=0,
135
+ depth=24,
136
+ embed_dim=1024,
137
+ ffn_bias=True,
138
+ ffn_layer='mlp',
139
+ img_size=512,
140
+ init_cfg=dict(
141
+ checkpoint='train/checkpoints/dinov2_converted.pth',
142
+ type='Pretrained'),
143
+ init_values=1e-05,
144
+ mlp_ratio=4,
145
+ num_heads=16,
146
+ patch_size=16,
147
+ proj_bias=True,
148
+ qkv_bias=True,
149
+ reins_config=dict(
150
+ embed_dims=1024,
151
+ link_token_to_query=True,
152
+ lora_dim=16,
153
+ num_layers=24,
154
+ patch_size=16,
155
+ token_length=100,
156
+ type='LoRAReins'),
157
+ type='ReinsDinoVisionTransformer'),
158
+ data_preprocessor=dict(
159
+ batch_augments=[
160
+ dict(
161
+ img_pad_value=0,
162
+ mask_pad_value=0,
163
+ pad_mask=True,
164
+ pad_seg=False,
165
+ seg_pad_value=255,
166
+ size=(
167
+ 512,
168
+ 512,
169
+ ),
170
+ type='BatchFixedSizePad'),
171
+ ],
172
+ bgr_to_rgb=True,
173
+ mask_pad_value=0,
174
+ mean=[
175
+ 123.675,
176
+ 116.28,
177
+ 103.53,
178
+ ],
179
+ pad_mask=True,
180
+ pad_seg=False,
181
+ pad_size_divisor=32,
182
+ seg_pad_value=255,
183
+ std=[
184
+ 58.395,
185
+ 57.12,
186
+ 57.375,
187
+ ],
188
+ type='DetDataPreprocessor'),
189
+ init_cfg=None,
190
+ panoptic_fusion_head=dict(
191
+ init_cfg=None,
192
+ loss_panoptic=None,
193
+ num_stuff_classes=0,
194
+ num_things_classes=1,
195
+ type='MaskFormerFusionHead'),
196
+ panoptic_head=dict(
197
+ enforce_decoder_input_project=False,
198
+ feat_channels=256,
199
+ in_channels=[
200
+ 1024,
201
+ 1024,
202
+ 1024,
203
+ 1024,
204
+ ],
205
+ loss_cls=dict(
206
+ class_weight=[
207
+ 1.0,
208
+ 0.1,
209
+ ],
210
+ loss_weight=2.0,
211
+ reduction='mean',
212
+ type='CrossEntropyLoss',
213
+ use_sigmoid=False),
214
+ loss_dice=dict(
215
+ activate=True,
216
+ eps=1.0,
217
+ loss_weight=5.0,
218
+ naive_dice=True,
219
+ reduction='mean',
220
+ type='DiceLoss',
221
+ use_sigmoid=True),
222
+ loss_mask=dict(
223
+ loss_weight=5.0,
224
+ reduction='mean',
225
+ type='CrossEntropyLoss',
226
+ use_sigmoid=True),
227
+ num_queries=100,
228
+ num_stuff_classes=0,
229
+ num_things_classes=1,
230
+ num_transformer_feat_level=3,
231
+ out_channels=256,
232
+ pixel_decoder=dict(
233
+ act_cfg=dict(type='ReLU'),
234
+ encoder=dict(
235
+ layer_cfg=dict(
236
+ ffn_cfg=dict(
237
+ act_cfg=dict(inplace=True, type='ReLU'),
238
+ embed_dims=256,
239
+ feedforward_channels=1024,
240
+ ffn_drop=0.0,
241
+ num_fcs=2),
242
+ self_attn_cfg=dict(
243
+ batch_first=True,
244
+ dropout=0.0,
245
+ embed_dims=256,
246
+ num_heads=8,
247
+ num_levels=3,
248
+ num_points=4)),
249
+ num_layers=6),
250
+ norm_cfg=dict(num_groups=32, type='GN'),
251
+ num_outs=3,
252
+ positional_encoding=dict(normalize=True, num_feats=128),
253
+ type='MSDeformAttnPixelDecoder'),
254
+ positional_encoding=dict(normalize=True, num_feats=128),
255
+ strides=[
256
+ 4,
257
+ 8,
258
+ 16,
259
+ 32,
260
+ ],
261
+ transformer_decoder=dict(
262
+ init_cfg=None,
263
+ layer_cfg=dict(
264
+ cross_attn_cfg=dict(
265
+ batch_first=True, dropout=0.0, embed_dims=256,
266
+ num_heads=8),
267
+ ffn_cfg=dict(
268
+ act_cfg=dict(inplace=True, type='ReLU'),
269
+ embed_dims=256,
270
+ feedforward_channels=2048,
271
+ ffn_drop=0.0,
272
+ num_fcs=2),
273
+ self_attn_cfg=dict(
274
+ batch_first=True, dropout=0.0, embed_dims=256,
275
+ num_heads=8)),
276
+ num_layers=9,
277
+ return_intermediate=True),
278
+ type='ReinMask2FormerHead'),
279
+ test_cfg=dict(
280
+ filter_low_score=True,
281
+ instance_on=True,
282
+ iou_thr=0.8,
283
+ max_per_image=100,
284
+ panoptic_on=False,
285
+ semantic_on=False),
286
+ train_cfg=dict(
287
+ assigner=dict(
288
+ match_costs=[
289
+ dict(type='ClassificationCost', weight=2.0),
290
+ dict(
291
+ type='CrossEntropyLossCost', use_sigmoid=True, weight=5.0),
292
+ dict(eps=1.0, pred_act=True, type='DiceCost', weight=5.0),
293
+ ],
294
+ type='HungarianAssigner'),
295
+ importance_sample_ratio=0.75,
296
+ num_points=12544,
297
+ oversample_ratio=3.0,
298
+ sampler=dict(type='MaskPseudoSampler')),
299
+ type='Mask2Former')
300
+ n_gpus = 6
301
+ num_classes = 1
302
+ num_stuff_classes = 0
303
+ num_things_classes = 1
304
+ num_workers = 16
305
+ optim_wrapper = dict(
306
+ clip_grad=dict(max_norm=0.01, norm_type=2),
307
+ constructor='PEFTOptimWrapperConstructor',
308
+ optimizer=dict(
309
+ betas=(
310
+ 0.9,
311
+ 0.999,
312
+ ),
313
+ eps=1e-08,
314
+ lr=9.375e-05,
315
+ type='AdamW',
316
+ weight_decay=0.05),
317
+ paramwise_cfg=dict(
318
+ custom_keys=dict(
319
+ backbone=dict(decay_mult=1.0, lr_mult=0.1),
320
+ level_embed=dict(decay_mult=0.0, lr_mult=1.0),
321
+ query_embed=dict(decay_mult=0.0, lr_mult=1.0),
322
+ query_feat=dict(decay_mult=0.0, lr_mult=1.0)),
323
+ norm_decay_mult=0.0),
324
+ type='OptimWrapper')
325
+ optimizer_config = dict(
326
+ cumulative_iters=4, type='GradientCumulativeOptimizerHook')
327
+ original_batch_size = 16
328
+ original_lr = 0.0001
329
+ original_n_gpus = 8
330
+ output_dir = 'StomataPy400K_stomatal_complex_24185'
331
+ param_scheduler = [
332
+ dict(
333
+ begin=0,
334
+ by_epoch=True,
335
+ convert_to_iter_based=True,
336
+ end=30,
337
+ end_factor=1.0,
338
+ start_factor=0.001,
339
+ type='LinearLR',
340
+ verbose=False),
341
+ dict(
342
+ T_max=210,
343
+ begin=30,
344
+ by_epoch=True,
345
+ convert_to_iter_based=True,
346
+ end=240,
347
+ eta_min=9.375e-08,
348
+ eta_min_ratio=None,
349
+ type='CosineAnnealingLR',
350
+ verbose=False),
351
+ dict(
352
+ by_epoch=True,
353
+ factor=0.75,
354
+ monitor='coco/bbox_mAP',
355
+ patience=50,
356
+ rule='greater',
357
+ type='ReduceOnPlateauLR',
358
+ verbose=False),
359
+ ]
360
+ randomness = dict(deterministic=False, seed=42)
361
+ resume = None
362
+ test_ann_file = 'COCO.json'
363
+ test_cfg = dict(type='ValLoop')
364
+ test_dataloader = dict(
365
+ batch_sampler=dict(type='AspectRatioBatchSampler'),
366
+ batch_size=2,
367
+ dataset=dict(
368
+ batch_size=2,
369
+ dataset=dict(
370
+ all_datasets=[
371
+ 'ClearStain_Brightfield',
372
+ 'Imprints_Brightfield',
373
+ 'Imprints_DIC',
374
+ 'Leaf_Brightfield',
375
+ 'Leaf_Topometry',
376
+ 'Peels_Brightfield',
377
+ 'Peels_SEM',
378
+ ],
379
+ ann_file='COCO.json',
380
+ backend_args=None,
381
+ data_prefix=dict(
382
+ img='test/', seg='annotations/panoptic_train2017/'),
383
+ data_root='StomataPy400K_train/',
384
+ metainfo=dict(classes=('stomatal complex', )),
385
+ pipeline=[
386
+ dict(to_float32=True, type='LoadImageFromFile'),
387
+ dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
388
+ ],
389
+ test_mode=False,
390
+ total_samples=866,
391
+ type='CocoEevenSamplerDataset'),
392
+ mode='val',
393
+ pipeline=[
394
+ dict(keep_ratio=True, scale=(
395
+ 1024,
396
+ 768,
397
+ ), type='Resize'),
398
+ dict(
399
+ meta_keys=(
400
+ 'img_id',
401
+ 'img_path',
402
+ 'img',
403
+ 'img_shape',
404
+ 'ori_shape',
405
+ 'scale_factor',
406
+ 'gt_bboxes',
407
+ 'gt_ignore_flags',
408
+ 'gt_bboxes_labels',
409
+ 'gt_masks',
410
+ ),
411
+ type='PackDetInputs'),
412
+ ],
413
+ type='MultiImageMixEvenSamplerDataset'),
414
+ drop_last=False,
415
+ num_workers=16,
416
+ persistent_workers=True,
417
+ sampler=dict(shuffle=False, type='DefaultSampler'))
418
+ test_dataset = dict(
419
+ batch_size=2,
420
+ dataset=dict(
421
+ all_datasets=[
422
+ 'ClearStain_Brightfield',
423
+ 'Imprints_Brightfield',
424
+ 'Imprints_DIC',
425
+ 'Leaf_Brightfield',
426
+ 'Leaf_Topometry',
427
+ 'Peels_Brightfield',
428
+ 'Peels_SEM',
429
+ ],
430
+ ann_file='COCO.json',
431
+ backend_args=None,
432
+ data_prefix=dict(img='test/', seg='annotations/panoptic_train2017/'),
433
+ data_root='StomataPy400K_train/',
434
+ metainfo=dict(classes=('stomatal complex', )),
435
+ pipeline=[
436
+ dict(to_float32=True, type='LoadImageFromFile'),
437
+ dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
438
+ ],
439
+ test_mode=False,
440
+ total_samples=866,
441
+ type='CocoEevenSamplerDataset'),
442
+ mode='val',
443
+ pipeline=[
444
+ dict(keep_ratio=True, scale=(
445
+ 1024,
446
+ 768,
447
+ ), type='Resize'),
448
+ dict(
449
+ meta_keys=(
450
+ 'img_id',
451
+ 'img_path',
452
+ 'img',
453
+ 'img_shape',
454
+ 'ori_shape',
455
+ 'scale_factor',
456
+ 'gt_bboxes',
457
+ 'gt_ignore_flags',
458
+ 'gt_bboxes_labels',
459
+ 'gt_masks',
460
+ ),
461
+ type='PackDetInputs'),
462
+ ],
463
+ type='MultiImageMixEvenSamplerDataset')
464
+ test_evaluator = dict(
465
+ ann_file='StomataPy400K_train/sahi_coco_val.json',
466
+ backend_args=None,
467
+ format_only=False,
468
+ metric=[
469
+ 'bbox',
470
+ 'segm',
471
+ ],
472
+ type='CocoMetric')
473
+ test_load_pipeline = [
474
+ dict(to_float32=True, type='LoadImageFromFile'),
475
+ dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
476
+ ]
477
+ test_pipeline = [
478
+ dict(keep_ratio=True, scale=(
479
+ 1024,
480
+ 768,
481
+ ), type='Resize'),
482
+ dict(
483
+ meta_keys=(
484
+ 'img_id',
485
+ 'img_path',
486
+ 'img',
487
+ 'img_shape',
488
+ 'ori_shape',
489
+ 'scale_factor',
490
+ 'gt_bboxes',
491
+ 'gt_ignore_flags',
492
+ 'gt_bboxes_labels',
493
+ 'gt_masks',
494
+ ),
495
+ type='PackDetInputs'),
496
+ ]
497
+ total_samples_train = 3455
498
+ total_samples_val = 866
499
+ train_ann_file = 'sahi_coco_train.json'
500
+ train_cfg = dict(max_epochs=240, type='EpochBasedTrainLoop', val_interval=1)
501
+ train_dataloader = dict(
502
+ batch_sampler=dict(type='AspectRatioBatchSampler'),
503
+ batch_size=2,
504
+ dataset=dict(
505
+ batch_size=2,
506
+ dataset=dict(
507
+ all_datasets=[
508
+ 'ClearStain_Brightfield',
509
+ 'Imprints_Brightfield',
510
+ 'Imprints_DIC',
511
+ 'Leaf_Brightfield',
512
+ 'Leaf_Topometry',
513
+ 'Peels_Brightfield',
514
+ 'Peels_SEM',
515
+ ],
516
+ ann_file='sahi_coco_train.json',
517
+ backend_args=None,
518
+ data_prefix=dict(
519
+ img='train_sahi/', seg='annotations/panoptic_train2017/'),
520
+ data_root='StomataPy400K_train/',
521
+ filter_cfg=dict(filter_empty_gt=True, min_size=32),
522
+ metainfo=dict(classes=('stomatal complex', )),
523
+ pipeline=[
524
+ dict(to_float32=True, type='LoadImageFromFile'),
525
+ dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
526
+ dict(prob=0.5, type='RandomFlip'),
527
+ dict(type='PhotoMetricDistortion'),
528
+ dict(
529
+ img_border_value=(
530
+ 0,
531
+ 0,
532
+ 0,
533
+ ),
534
+ interpolation='lanczos',
535
+ prob=0.5,
536
+ type='GeomTransform'),
537
+ dict(keep_ratio=True, scale=(
538
+ 1024,
539
+ 768,
540
+ ), type='Resize'),
541
+ ],
542
+ total_samples=3455,
543
+ type='CocoEevenSamplerDataset'),
544
+ mode='train',
545
+ n_gpus=6,
546
+ n_workers=16,
547
+ pipeline=[
548
+ dict(
549
+ bbox_occluded_thr=50,
550
+ mask_occluded_thr=1000,
551
+ max_num_pasted=5,
552
+ paste_by_box=False,
553
+ selected=True,
554
+ type='CopyPaste'),
555
+ dict(
556
+ by_mask=True,
557
+ min_gt_bbox_wh=(
558
+ 10,
559
+ 10,
560
+ ),
561
+ min_gt_mask_area=10,
562
+ type='FilterAnnotations'),
563
+ dict(
564
+ meta_keys=(
565
+ 'img_path',
566
+ 'img',
567
+ 'gt_bboxes',
568
+ 'gt_ignore_flags',
569
+ 'gt_bboxes_labels',
570
+ 'gt_masks',
571
+ ),
572
+ type='PackDetInputs'),
573
+ ],
574
+ type='MultiImageMixEvenSamplerDataset'),
575
+ num_workers=16,
576
+ persistent_workers=True,
577
+ sampler=dict(shuffle=True, type='DefaultSampler'))
578
+ train_dataset = dict(
579
+ batch_size=2,
580
+ dataset=dict(
581
+ all_datasets=[
582
+ 'ClearStain_Brightfield',
583
+ 'Imprints_Brightfield',
584
+ 'Imprints_DIC',
585
+ 'Leaf_Brightfield',
586
+ 'Leaf_Topometry',
587
+ 'Peels_Brightfield',
588
+ 'Peels_SEM',
589
+ ],
590
+ ann_file='sahi_coco_train.json',
591
+ backend_args=None,
592
+ data_prefix=dict(
593
+ img='train_sahi/', seg='annotations/panoptic_train2017/'),
594
+ data_root='StomataPy400K_train/',
595
+ filter_cfg=dict(filter_empty_gt=True, min_size=32),
596
+ metainfo=dict(classes=('stomatal complex', )),
597
+ pipeline=[
598
+ dict(to_float32=True, type='LoadImageFromFile'),
599
+ dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
600
+ dict(prob=0.5, type='RandomFlip'),
601
+ dict(type='PhotoMetricDistortion'),
602
+ dict(
603
+ img_border_value=(
604
+ 0,
605
+ 0,
606
+ 0,
607
+ ),
608
+ interpolation='lanczos',
609
+ prob=0.5,
610
+ type='GeomTransform'),
611
+ dict(keep_ratio=True, scale=(
612
+ 1024,
613
+ 768,
614
+ ), type='Resize'),
615
+ ],
616
+ total_samples=3455,
617
+ type='CocoEevenSamplerDataset'),
618
+ mode='train',
619
+ n_gpus=6,
620
+ n_workers=16,
621
+ pipeline=[
622
+ dict(
623
+ bbox_occluded_thr=50,
624
+ mask_occluded_thr=1000,
625
+ max_num_pasted=5,
626
+ paste_by_box=False,
627
+ selected=True,
628
+ type='CopyPaste'),
629
+ dict(
630
+ by_mask=True,
631
+ min_gt_bbox_wh=(
632
+ 10,
633
+ 10,
634
+ ),
635
+ min_gt_mask_area=10,
636
+ type='FilterAnnotations'),
637
+ dict(
638
+ meta_keys=(
639
+ 'img_path',
640
+ 'img',
641
+ 'gt_bboxes',
642
+ 'gt_ignore_flags',
643
+ 'gt_bboxes_labels',
644
+ 'gt_masks',
645
+ ),
646
+ type='PackDetInputs'),
647
+ ],
648
+ type='MultiImageMixEvenSamplerDataset')
649
+ train_pipeline = [
650
+ dict(
651
+ bbox_occluded_thr=50,
652
+ mask_occluded_thr=1000,
653
+ max_num_pasted=5,
654
+ paste_by_box=False,
655
+ selected=True,
656
+ type='CopyPaste'),
657
+ dict(
658
+ by_mask=True,
659
+ min_gt_bbox_wh=(
660
+ 10,
661
+ 10,
662
+ ),
663
+ min_gt_mask_area=10,
664
+ type='FilterAnnotations'),
665
+ dict(
666
+ meta_keys=(
667
+ 'img_path',
668
+ 'img',
669
+ 'gt_bboxes',
670
+ 'gt_ignore_flags',
671
+ 'gt_bboxes_labels',
672
+ 'gt_masks',
673
+ ),
674
+ type='PackDetInputs'),
675
+ ]
676
+ val_ann_file = 'sahi_coco_val.json'
677
+ val_cfg = dict(type='ValLoop')
678
+ val_dataloader = dict(
679
+ batch_sampler=dict(type='AspectRatioBatchSampler'),
680
+ batch_size=2,
681
+ dataset=dict(
682
+ batch_size=2,
683
+ dataset=dict(
684
+ all_datasets=[
685
+ 'ClearStain_Brightfield',
686
+ 'Imprints_Brightfield',
687
+ 'Imprints_DIC',
688
+ 'Leaf_Brightfield',
689
+ 'Leaf_Topometry',
690
+ 'Peels_Brightfield',
691
+ 'Peels_SEM',
692
+ ],
693
+ ann_file='sahi_coco_val.json',
694
+ backend_args=None,
695
+ data_prefix=dict(
696
+ img='val_sahi/', seg='annotations/panoptic_train2017/'),
697
+ data_root='StomataPy400K_train/',
698
+ metainfo=dict(classes=('stomatal complex', )),
699
+ pipeline=[
700
+ dict(to_float32=True, type='LoadImageFromFile'),
701
+ dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
702
+ ],
703
+ test_mode=False,
704
+ total_samples=866,
705
+ type='CocoEevenSamplerDataset'),
706
+ mode='val',
707
+ n_gpus=6,
708
+ n_workers=16,
709
+ pipeline=[
710
+ dict(keep_ratio=True, scale=(
711
+ 1024,
712
+ 768,
713
+ ), type='Resize'),
714
+ dict(
715
+ meta_keys=(
716
+ 'img_id',
717
+ 'img_path',
718
+ 'img',
719
+ 'img_shape',
720
+ 'ori_shape',
721
+ 'scale_factor',
722
+ 'gt_bboxes',
723
+ 'gt_ignore_flags',
724
+ 'gt_bboxes_labels',
725
+ 'gt_masks',
726
+ ),
727
+ type='PackDetInputs'),
728
+ ],
729
+ type='MultiImageMixEvenSamplerDataset'),
730
+ drop_last=False,
731
+ num_workers=16,
732
+ persistent_workers=True,
733
+ sampler=dict(shuffle=False, type='DefaultSampler'))
734
+ val_dataset = dict(
735
+ batch_size=2,
736
+ dataset=dict(
737
+ all_datasets=[
738
+ 'ClearStain_Brightfield',
739
+ 'Imprints_Brightfield',
740
+ 'Imprints_DIC',
741
+ 'Leaf_Brightfield',
742
+ 'Leaf_Topometry',
743
+ 'Peels_Brightfield',
744
+ 'Peels_SEM',
745
+ ],
746
+ ann_file='sahi_coco_val.json',
747
+ backend_args=None,
748
+ data_prefix=dict(
749
+ img='val_sahi/', seg='annotations/panoptic_train2017/'),
750
+ data_root='StomataPy400K_train/',
751
+ metainfo=dict(classes=('stomatal complex', )),
752
+ pipeline=[
753
+ dict(to_float32=True, type='LoadImageFromFile'),
754
+ dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
755
+ ],
756
+ test_mode=False,
757
+ total_samples=866,
758
+ type='CocoEevenSamplerDataset'),
759
+ mode='val',
760
+ n_gpus=6,
761
+ n_workers=16,
762
+ pipeline=[
763
+ dict(keep_ratio=True, scale=(
764
+ 1024,
765
+ 768,
766
+ ), type='Resize'),
767
+ dict(
768
+ meta_keys=(
769
+ 'img_id',
770
+ 'img_path',
771
+ 'img',
772
+ 'img_shape',
773
+ 'ori_shape',
774
+ 'scale_factor',
775
+ 'gt_bboxes',
776
+ 'gt_ignore_flags',
777
+ 'gt_bboxes_labels',
778
+ 'gt_masks',
779
+ ),
780
+ type='PackDetInputs'),
781
+ ],
782
+ type='MultiImageMixEvenSamplerDataset')
783
+ val_evaluator = dict(
784
+ ann_file='StomataPy400K_train/sahi_coco_val.json',
785
+ backend_args=None,
786
+ format_only=False,
787
+ metric=[
788
+ 'bbox',
789
+ 'segm',
790
+ ],
791
+ type='CocoMetric')
792
+ val_interval = 1
793
+ visualizer = dict(
794
+ name='visualizer',
795
+ type='DetLocalVisualizer',
796
+ vis_backends=[
797
+ dict(type='LocalVisBackend'),
798
+ dict(
799
+ init_kwargs=dict(
800
+ name='StomataPy400K_stomatal_complex_24185',
801
+ project='StomataPy'),
802
+ type='WandbVisBackend'),
803
+ ])
804
+ wandb_project = 'StomataPy'
805
+ warmup_epochs = 30
806
+ with_cp = True
807
+ work_dir = '..//Models//StomataPy400K_stomatal_complex_24185'
StomataPy400K_denisty_24185/dinov2_detector.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:658305aad1995c0ea8580aae8bcee4479705216ef7cf745a910e7ab0030ba60b
3
+ size 1630708123