"""
Faster R-CNN with Normalized Wasserstein Assigner
Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=1500 ] = 0.134
Average Precision  (AP) @[ IoU=0.25      | area=   all | maxDets=1500 ] = -1.000
Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.356
Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=1500 ] = 0.070
Average Precision  (AP) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.027
Average Precision  (AP) @[ IoU=0.50:0.95 | area=  tiny | maxDets=1500 ] = 0.126
Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.223
Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.251
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.245
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 ] = 0.264
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=1500 ] = 0.267
Average Recall     (AR) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.042
Average Recall     (AR) @[ IoU=0.50:0.95 | area=  tiny | maxDets=1500 ] = 0.256
Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.405
Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.368
Optimal LRP             @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.874
Optimal LRP Loc         @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.311
Optimal LRP FP          @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.504
Optimal LRP FN          @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.579
# Class-specific LRP-Optimal Thresholds # 
 [0.707 0.869 0.94  0.918 0.482 0.857 0.872 0.592]

+----------+-------+---------------+-------+--------------+-------+
| category | AP    | category      | AP    | category     | AP    |
+----------+-------+---------------+-------+--------------+-------+
| airplane | 0.181 | bridge        | 0.047 | storage-tank | 0.253 |
| ship     | 0.264 | swimming-pool | 0.058 | vehicle      | 0.186 |
| person   | 0.061 | wind-mill     | 0.023 | None         | None  |
+----------+-------+---------------+-------+--------------+-------+

+----------+-------+---------------+-------+--------------+-------+
| category | oLRP  | category      | oLRP  | category     | oLRP  |
+----------+-------+---------------+-------+--------------+-------+
| airplane | 0.843 | bridge        | 0.954 | storage-tank | 0.764 |
| ship     | 0.753 | swimming-pool | 0.937 | vehicle      | 0.831 |
| person   | 0.933 | wind-mill     | 0.973 | None         | None  |
+----------+-------+---------------+-------+--------------+-------+



"""

_base_ = [
    '../_base_/models/faster_rcnn_r50_fpn_aitod.py',
    '../_base_/datasets/aitod_detection.py',
    '../_base_/schedules/schedule_1x.py', 
    '../_base_/default_runtime.py'
]

model = dict(
    train_cfg=dict(
            rpn=dict(
                assigner=dict(
                    pos_iou_thr=0.6,
                    neg_iou_thr=0.4,
                    min_pos_iou=0.4,
                    iou_calculator=dict(type='BboxDistanceMetric'),
                    assign_metric='wasserstein')),
            rcnn=dict(
                assigner=dict(
                    pos_iou_thr=0.6,
                    neg_iou_thr=0.4,
                    min_pos_iou=0.4,
                    iou_calculator=dict(type='BboxDistanceMetric'),
                    assign_metric='wasserstein'))))

# optimizer
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
# learning policy
checkpoint_config = dict(interval=4)

"""
Faster R-CNN with Normalized Wasserstein Assigner
Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=1500 ] = 0.134
Average Precision  (AP) @[ IoU=0.25      | area=   all | maxDets=1500 ] = -1.000
Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.356
Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=1500 ] = 0.070
Average Precision  (AP) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.027
Average Precision  (AP) @[ IoU=0.50:0.95 | area=  tiny | maxDets=1500 ] = 0.126
Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.223
Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.251
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.245
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 ] = 0.264
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=1500 ] = 0.267
Average Recall     (AR) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.042
Average Recall     (AR) @[ IoU=0.50:0.95 | area=  tiny | maxDets=1500 ] = 0.256
Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.405
Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.368
Optimal LRP             @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.874
Optimal LRP Loc         @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.311
Optimal LRP FP          @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.504
Optimal LRP FN          @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.579
# Class-specific LRP-Optimal Thresholds # 
 [0.707 0.869 0.94  0.918 0.482 0.857 0.872 0.592]

+----------+-------+---------------+-------+--------------+-------+
| category | AP    | category      | AP    | category     | AP    |
+----------+-------+---------------+-------+--------------+-------+
| airplane | 0.181 | bridge        | 0.047 | storage-tank | 0.253 |
| ship     | 0.264 | swimming-pool | 0.058 | vehicle      | 0.186 |
| person   | 0.061 | wind-mill     | 0.023 | None         | None  |
+----------+-------+---------------+-------+--------------+-------+

+----------+-------+---------------+-------+--------------+-------+
| category | oLRP  | category      | oLRP  | category     | oLRP  |
+----------+-------+---------------+-------+--------------+-------+
| airplane | 0.843 | bridge        | 0.954 | storage-tank | 0.764 |
| ship     | 0.753 | swimming-pool | 0.937 | vehicle      | 0.831 |
| person   | 0.933 | wind-mill     | 0.973 | None         | None  |
+----------+-------+---------------+-------+--------------+-------+



"""

_base_ = [
    '../_base_/models/faster_rcnn_r50_fpn_aitod.py',
    '../_base_/datasets/aitod_detection.py',
    '../_base_/schedules/schedule_1x.py', 
    '../_base_/default_runtime.py'
]

model = dict(
    train_cfg=dict(
            rpn=dict(
                assigner=dict(
                    pos_iou_thr=0.6,
                    neg_iou_thr=0.4,
                    min_pos_iou=0.4,
                    iou_calculator=dict(type='BboxDistanceMetric'),
                    assign_metric='wasserstein')),
            rcnn=dict(
                assigner=dict(
                    pos_iou_thr=0.6,
                    neg_iou_thr=0.4,
                    min_pos_iou=0.4,
                    iou_calculator=dict(type='BboxDistanceMetric'),
                    assign_metric='wasserstein'))))

# optimizer
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
# learning policy
checkpoint_config = dict(interval=4)

Faster R-CNN with Normalized Wasserstein Assigner Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=1500 ] = 0.134 Average Precision  (AP) @[ IoU=0.25      | area=   all | maxDets=1500 ] = -1.000 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.356 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=1500 ] = 0.070 Average Precision  (AP) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.027 Average Precision  (AP) @[ IoU=0.50:0.95 | area=  tiny | maxDets=1500 ] = 0.126 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.223 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.251 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.245 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 ] = 0.264 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=1500 ] = 0.267 Average Recall     (AR) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.042 Average Recall     (AR) @[ IoU=0.50:0.95 | area=  tiny | maxDets=1500 ] = 0.256 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.405 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.368 Optimal LRP             @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.874 Optimal LRP Loc         @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.311 Optimal LRP FP          @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.504 Optimal LRP FN          @[ IoU=0.50      | area=   all | maxDets=1500 ] = 0.579 # Class-specific LRP-Optimal Thresholds #   [0.707 0.869 0.94  0.918 0.482 0.857 0.872 0.592]  +----------+-------+---------------+-------+--------------+-------+ | category | AP    | category      | AP    | category     | AP    | +----------+-------+---------------+-------+--------------+-------+ | airplane | 0.181 | bridge        | 0.047 | storage-tank | 0.253 | | ship     | 0.264 | swimming-pool | 0.058 | vehicle      | 0.186 | | person   | 0.061 | wind-mill     | 0.023 | None         | None  | +----------+-------+---------------+-------+--------------+-------+  +----------+-------+---------------+-------+--------------+-------+ | category | oLRP  | category      | oLRP  | category     | oLRP  | +----------+-------+---------------+-------+--------------+-------+ | airplane | 0.843 | bridge        | 0.954 | storage-tank | 0.764 | | ship     | 0.753 | swimming-pool | 0.937 | vehicle      | 0.831 | | person   | 0.933 | wind-mill     | 0.973 | None         | None  | +----------+-------+---------------+-------+--------------+-------+ # optimizer # learning policy