|
Algorithm 1 Segment and Recover (SAR) |
-
Input:
input image x, window size , matching threshold T, Base Detector BaseDetector.
-
Output:
robust detection , inpainted images and CAUTION
|
-
1:
procedure
Sar
-
2:
AdvPredictor
-
3:
AdvDetector
-
4:
PixelRestoration
-
5:
BaseDetector
-
6:
if
then
-
7:
-
8:
else
-
9:
-
10:
end if
-
11:
return
-
12:
end procedure
-
-
13:
procedure
AdvPredictor
-
14:
← Fe(x)
-
15:
← Shape(fm)
-
16:
← ZeroArray[X, Y, N + 1]
-
17:
for each valid do
-
18:
Jpeg
-
19:
-
20:
end for
-
21:
← Binarize(am, T, wx, wy)
-
22:
return
-
23:
end procedure
|
▹ Adversary detection (frontend) ▹ Adversary localization
▹ Broken pixel restoration (backend)
▹ Conventional detection
▹ Trigger a caution
▹ Extract feature map
▹ Get the shape of fm
▹ Initialization
▹ Every window location ▹ Binarization |
-
24:
procedure
AdvDetector
-
25:
← FastSamAutomaticMaskGenerator(x)
-
26:
← Shape(seg, am)
-
27:
← Area_Seg
-
28:
← Area_Am
-
29:
for each valid do
-
30:
for each valid do
-
31:
-
32:
-
33:
-
34:
if then
-
35:
return 0
-
36:
else
-
37:
← Binarize(am)
-
38:
return pm
-
39:
end if
-
40:
end for
-
41:
end for
-
42:
end procedure
|
▹ Extract segmentation layer by layer ▹Get the left, top, right, and bottom of seg ▹ Initialization area of segmentation ▹ Initialization area of adversarial patch map ▹ Every segmentation ▹ Every Am ▹ Area of intersection ▹ Area of union ▹ Calculate IoU ▹ No overlap ▹ Binarization ▹ Return patch map
|
|
▹ Apply real FFT to input tensor ▹ Concatenate real and imaginary parts ▹ Apply a convolution block in the frequency domain ▹ Apply an inverse transform to recover a spatial structure |