<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>ENDOSCOPY ARTEFACT DETECTION AND SEGMENTATION USING DEEP CONVOLUTIONAL NEURAL NETWORK Haijian Chen, Chenyu Lian, Liansheng Wang</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Computer Science, School of Informatics, Xiamen University</institution>
          ,
          <country country="CN">China</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Endoscopy Artefact Detection and Segmentation (EAD2020) includes 3 sub-tasks: Multi-class artefact detection, Semantic segmentation and Out-of-sample generalisation. This manuscript summarizes our solution. The challenge can be considered as two independent problems: object detection and semantic segmentation. For the detection problem, we use Cascade R-CNN with FPN and Hyper Task Cascade. For the segmentation problem, we use DeepLab v3+ model with bce+dice loss.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. INTRODUCTION</title>
      <p>Endoscopy is a widely used clinical procedure for the early
detection of numerous cancers. However, a major drawback
of these video frames is that they are heavily corrupted with
multiple artifacts. Thus, accurate detection and even
segmentation of artifacts are very helpful to improve the endoscopy
tools. This task aims to localise bounding boxes, predict
class labels and pixel-wise segmentation of 8 different
artifact classes for given frames and clinical endoscopy video
clips.</p>
    </sec>
    <sec id="sec-2">
      <title>2. DATASETS</title>
      <p>
        The details of Endoscopy Artifact Detection and
Segmentation Dataset are described well in the original papers [
        <xref ref-type="bibr" rid="ref1">1, 2, 3</xref>
        ].
The following part gives a brief analysis of EAD2020 data.
      </p>
    </sec>
    <sec id="sec-3">
      <title>2.1. Object detection</title>
      <p>We combine the two phases of the dataset together. As shown
in Table 1, the distribution of different classes is very
imbalanced. The counts of ‘blur’, ‘instrument’, and ‘blood’ are
significantly smaller than others, which could become hard
examples when training models. The counts of ‘specularity’
and ‘artifact’ are very big and the objects of them are very
small in size. Based on the condition, we pay attention to the
balance of each class when we divide 20% of data as
validation set.</p>
      <p>Copyright c 2020 for this paper by its authors. Use permitted under
Creative Commons License Attribution 4.0 International (CC BY 4.0).</p>
      <sec id="sec-3-1">
        <title>Class</title>
        <p>specularity
saturation
artifact
blur</p>
      </sec>
      <sec id="sec-3-2">
        <title>Ratio</title>
        <p>36.2%
4.7%
29.6%
2.5%</p>
      </sec>
      <sec id="sec-3-3">
        <title>Class</title>
        <p>contrast
bubbles
instrument
blood</p>
      </sec>
      <sec id="sec-3-4">
        <title>Ratio</title>
        <p>6.1%
17.3%
1.7%
1.8%
fg/Pfg
36.39%
10.69%
9.33%
20.40%
23.18%
fg/(fg+bg)
4.13%
1.21%
1.06%
2.31%
2.63%</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>2.2. Semantic segmentation</title>
      <p>Many ground-truth pixel values are between 0 and 255 in the
dataset. After dividing all ground truth pixel values by 255
and using a threshold of 0.5 to classify foreground and
background pixels, the results are shown in Table 2. Foreground
pixels are significantly fewer than background pixels. The
foreground pixels of different classes in ground-truth images
are imbalanced as well. As shown in Table 3, the most
common size of images is 512 512 and 1349 1079. The others
contain different sizes. We shuffle the dataset randomly and
use 20% of the data as the validation set.</p>
    </sec>
    <sec id="sec-5">
      <title>3. METHODS</title>
    </sec>
    <sec id="sec-6">
      <title>3.1. Object Detection</title>
      <sec id="sec-6-1">
        <title>3.1.1. Model Overview</title>
        <p>
          We use Cascade R-CNN [
          <xref ref-type="bibr" rid="ref2">4</xref>
          ] with ResNetXt-101 [
          <xref ref-type="bibr" rid="ref3">5</xref>
          ]
backbone and FPN [
          <xref ref-type="bibr" rid="ref4">6</xref>
          ] as the neck of the model. We also train a
Hyper Task Cascade model [
          <xref ref-type="bibr" rid="ref5">7</xref>
          ] with the same backbone and
neck.
3.1.2. Loss
We use Cross Entropy Loss for classification. Smooth L1
Loss is utilized to improve the precision of detection.
        </p>
      </sec>
      <sec id="sec-6-2">
        <title>3.1.3. Augmentation</title>
        <p>In training data, we perform random flip, normalization and
resizing. The images are resized to 512 512.</p>
      </sec>
      <sec id="sec-6-3">
        <title>3.1.4. Implementation Details</title>
        <p>
          We extract candidate bounding box with RPN (region
proposal network) , and use non-maximum suppression (NMS)
to filter the useful bounding-box. Observing that some small
objects are ignored, NMS threshold is increased from 0.7
to 0.8. It slightly improves the recall rate and mAP.
SoftNMS [
          <xref ref-type="bibr" rid="ref6">8</xref>
          ] is applied to avoid mistakenly discard the
boundingbox directly.
        </p>
        <p>We use SGD optimizer with a momentum of 0.9 and a
weight decay of 0.0001. In order to get better results when
convergence, we add a warm-up period to make the training
rate linearly increase to 0.0025 in the first 500 iterations. The
network is trained for 13 epochs totally.</p>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>3.2. Semantic Segmentation</title>
      <sec id="sec-7-1">
        <title>3.2.1. Model Overview</title>
        <p>
          We use DeepLab V3+ network [
          <xref ref-type="bibr" rid="ref7">9</xref>
          ] with ResNet101 [
          <xref ref-type="bibr" rid="ref3">5</xref>
          ]
backbone for semantic segmentation. DeepLab V3+ is an
encoderdecoder network with dilation convolution. ASPP modules
and decoder is implemented as the original paper does.
        </p>
        <p>
          The output of the network is activated by sigmoid function
to get the probability map, since there may be overlap among
different channels of the mask. The segmentation problem is
considered as multiple binary segmentation tasks.
3.2.2. Loss
We evaluated different losses, including Binary Cross
Entropy, Dice Loss, Lovsz-Hinge Loss [
          <xref ref-type="bibr" rid="ref8">10</xref>
          ], and their
combination. Based on the testing results discussed in 4.2, we choose
bce+dice as the loss of our model at last, which simply means
L = Lbce + Ldice =
ygt log ypred
(1
        </p>
        <p>ygt) log ypred
+ 1
(2 P ygt ypred +
P ygt + P ypred +
)
( = 10 7, ygt and ypred are flattened tensors)</p>
      </sec>
      <sec id="sec-7-2">
        <title>3.2.3. Augmentation</title>
        <p>
          We apply random brightness and contrast changes, random
horizontal and vertical flip, random shift scale rotation,
Gaussian blurring, resizing and normalization to images of the
training set. All random transformations are applied by a
probability of 0.5 with the default parameters of
Albumentations library [
          <xref ref-type="bibr" rid="ref9">11</xref>
          ]. We apply image normalization in the
validation set.
        </p>
        <p>The images are resized to 512 512 and 1024 1024
during the training phase, see 4.2.</p>
      </sec>
      <sec id="sec-7-3">
        <title>3.2.4. Implementation Details</title>
        <p>
          We load the weights pre-trained on the ImageNet for the
backbone network. The network is trained using SGD with a
momentum of 0.9 and a weight decay of 0.0001. We train the
model using mini-batches of size 4. The learning rate is
increased linearly over the warm-up period of 5 epochs, to the
maximum value of 0.01, then adjusted by cosine annealing
with warm restarts [
          <xref ref-type="bibr" rid="ref10">12</xref>
          ] by a period of 40 epochs. The images
are resized to 512 512 to train 200 epochs and then resized
to 1024 1024 to train another 100 epochs.
        </p>
      </sec>
    </sec>
    <sec id="sec-8">
      <title>4. RESULTS</title>
    </sec>
    <sec id="sec-9">
      <title>4.1. Object Detection</title>
      <p>The results of Table 6,7,8 are provided by the official
leaderboard. Table 6 shows the detection scores in the first
phase of test data. The Hybrid Task Cascade network
performs better in mAP, while getting a lower score in IoU.</p>
      <p>Table 7 shows the scores in the final test. We get a higher
detection score with the Cascade R-CNN network.</p>
      <p>As shown in Table 8, resizing the image to 1024 1024
instead of 512 512 doesn’t give a better score but contributes
to generalization performance.</p>
    </sec>
    <sec id="sec-10">
      <title>4.2. Semantic Segmentation</title>
      <sec id="sec-10-1">
        <title>4.2.1. Experiments of losses in validation set</title>
        <p>
          To evaluate the results of different losses, we train a DeepLab
V3+ model with ResNet101 backbone and a modified
UNet [
          <xref ref-type="bibr" rid="ref11">13</xref>
          ] model with ResNet-34 backbone for 160 epochs.
        </p>
        <p>The threshold to predict foreground pixels is 0.5. Other
configurations are the same as 3.2.4. In Table 9 and Table
10, ‘bce is Binary Cross Entropy loss, ‘dice is Dice Loss,
‘bce+dice’ is defined in 3.2.2. All ‘p’ and ‘r’ in the tables
stand for precision and recall.</p>
        <p>In Table 9, the experiment shows that bce+dice gets the
best score in Dice, F2, and IoU score. The precision of
bce+dice is pretty close to dice, while not losing much recall.
In Table 10, we can see a significant improvement of UNet
using bce+dice, showing the effectiveness of this loss.</p>
        <p>After 300 epochs, the DeepLabV3+ model using bce+dice
got 0.7927 in F1, 0.8386 in F2, 0.6857 in IoU, 0.7422 in
precision and 0.887 in recall. The U-Net models don’t get much
better scores as they almost converge after 165 epochs.</p>
        <p>We also tested Lovsz-Hinge loss. In our test, it is hard to
converge if the model is trained from the ground up. Hence,
we use Lovsz-Hinge loss to fine-tune the Deeplab model
trained with bce+dice for 300 epochs. Table 11 shows the
results of the first 20 epochs (Epochs means the training epochs
with Lovsz). This model converges after 30 epochs but these
results are worse than the model before fine-tuning, so we
give up this method.</p>
        <p>We choose bce+dice to train the final model.</p>
      </sec>
      <sec id="sec-10-2">
        <title>4.2.2. Experiments of backbones in validation set</title>
        <p>Table 12 shows another experiment to compare different
networks. We find that Xception-based DeepLabV3+ converges
significantly slower than ResNet101-based model, and does
not get better scores than the U-Net model.</p>
        <sec id="sec-10-2-1">
          <title>Model D-X D-R101 U-R34</title>
          <p>F1
0.4189
0.5823
0.5535</p>
        </sec>
      </sec>
      <sec id="sec-10-3">
        <title>4.2.3. Submission results</title>
        <p>The training parameters are listed in 3.2.4. All the results
above are provided by the official leaderboard. In Table 13,
Model 1 is trained with 512 512 images and a threshold
of 0.5. Model 2 is the same as model 1 except changing the
threshold to 0.7. Model 3 is trained with 1024 1024 images
and a threshold of 0.7.</p>
        <p>We resized the image to 512 512 at first. However, as
discussed in Table 3, there are many bigger images. This can
be found in the first phase of test images as well. Compared
with the models only trained with images resized to 512
512, models trained with 1024 1024 get better scores in the
validation set. Some predictions look smoother, as shown in
Figure 2,3,4.</p>
        <p>We find that adding segmentation data of EAD2019 to the
training set also helps a little, although there is potential
validation data leakage, making validation metrics unbelievable.
However, it does not help in the detection task.</p>
        <p>We chose Model 3 to predict the final test data and got
scores as Table 14 shows.</p>
      </sec>
    </sec>
    <sec id="sec-11">
      <title>5. DISCUSSION &amp; CONCLUSION</title>
      <p>In task 1, we compare Cascade R-CNN with Hyper Task
Cascade to get a better detection model. FPN and Soft-NMS are
used to improve the detection precision due to class
imbalance. A proper threshold of NMS is helpful to improve the
recall rate of small objects.</p>
      <p>In task 2, we select DeepLabV3+ to solve the problem.
We select bce+dice as the loss function to balance precision
and recall. Image sizes of the dataset is a noticeable part at
the training phase. Adjusting the threshold of predicting also
contributes to a more balanced model.</p>
    </sec>
    <sec id="sec-12">
      <title>6. REFERENCES</title>
      <p>[1] Sharib Ali, Felix Zhou, Christian Daul, Barbara Braden,
Adam Bailey, Stefano Realdon, James East, Georges
Wagnieres, Victor Loschenov, Enrico Grisan, et al.
Endoscopy artifact detection (ead 2019) challenge dataset.
arXiv preprint arXiv:1905.03209, 2019.
[2] Sharib Ali, Felix Zhou, Adam Bailey, Barbara Braden,
James East, Xin Lu, and Jens Rittscher. A deep
learning framework for quality assessment and restoration
in video endoscopy. arXiv preprint arXiv:1904.07073,
2019.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Sharib</given-names>
            <surname>Ali</surname>
          </string-name>
          , Felix Zhou, Barbara Braden, Adam Bailey, Suhui Yang, Guanju Cheng, Pengyi Zhang, Xiaoqiong Li,
          <string-name>
            <given-names>Maxime</given-names>
            <surname>Kayser</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Roger D.</given-names>
            <surname>Soberanis-Mukul</surname>
          </string-name>
          , Shadi Albarqouni, Xiaokang Wang,
          <string-name>
            <surname>Chunqing</surname>
            <given-names>Wang</given-names>
          </string-name>
          , Seiryo Watanabe, Ilkay Oksuz, Qingtian Ning, Shufan Yang, Mohammad Azam Khan, Xiaohong W. Gao, Stefano Realdon, Maxim Loshchenov, Julia A.
          <string-name>
            <surname>Schnabel</surname>
          </string-name>
          , James E. East, Geroges Wagnieres, Victor B.
          <string-name>
            <surname>Loschenov</surname>
            , Enrico Grisan, Christian Daul, Walter Blondel, and
            <given-names>Jens</given-names>
          </string-name>
          <string-name>
            <surname>Rittscher</surname>
          </string-name>
          .
          <article-title>An objective comparison of detection and segmentation algorithms for artefacts in clinical endoscopy</article-title>
          .
          <source>Scientific Reports</source>
          ,
          <volume>10</volume>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Zhaowei</given-names>
            <surname>Cai</surname>
          </string-name>
          and
          <string-name>
            <given-names>Nuno</given-names>
            <surname>Vasconcelos. Cascade</surname>
          </string-name>
          R-CNN:
          <article-title>delving into high quality object detection</article-title>
          .
          <source>CoRR, abs/1712.00726</source>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Kaiming</given-names>
            <surname>He</surname>
          </string-name>
          , Xiangyu Zhang, Shaoqing Ren, and
          <string-name>
            <given-names>Jian</given-names>
            <surname>Sun</surname>
          </string-name>
          .
          <article-title>Deep residual learning for image recognition</article-title>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Tsung-Yi</surname>
            <given-names>Lin</given-names>
          </string-name>
          , Piotr Dolla´r, Ross B.
          <string-name>
            <surname>Girshick</surname>
          </string-name>
          , Kaiming He,
          <string-name>
            <surname>Bharath Hariharan</surname>
            , and
            <given-names>Serge J.</given-names>
          </string-name>
          <string-name>
            <surname>Belongie</surname>
          </string-name>
          .
          <article-title>Feature pyramid networks for object detection</article-title>
          .
          <source>CoRR, abs/1612.03144</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Kai</given-names>
            <surname>Chen</surname>
          </string-name>
          , Jiangmiao Pang,
          <string-name>
            <surname>Jiaqi</surname>
            <given-names>Wang</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yu</surname>
            <given-names>Xiong</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Xiaoxiao</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Shuyang</given-names>
            <surname>Sun</surname>
          </string-name>
          , Wansen Feng, Ziwei Liu, Jianping Shi, Wanli Ouyang, Chen Change Loy, and
          <string-name>
            <given-names>Dahua</given-names>
            <surname>Lin</surname>
          </string-name>
          .
          <article-title>Hybrid task cascade for instance segmentation</article-title>
          .
          <source>CoRR</source>
          , abs/
          <year>1901</year>
          .07518,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Navaneeth</given-names>
            <surname>Bodla</surname>
          </string-name>
          , Bharat Singh,
          <string-name>
            <given-names>Rama</given-names>
            <surname>Chellappa</surname>
          </string-name>
          , and
          <string-name>
            <surname>Larry</surname>
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Davis</surname>
          </string-name>
          .
          <article-title>Improving object detection with one line of code</article-title>
          . CoRR, abs/1704.04503,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [9]
          <string-name>
            <surname>Liang-Chieh</surname>
            <given-names>Chen</given-names>
          </string-name>
          , Yukun Zhu, George Papandreou, Florian Schroff, and
          <string-name>
            <given-names>Hartwig</given-names>
            <surname>Adam</surname>
          </string-name>
          .
          <article-title>Encoder-decoder with atrous separable convolution for semantic image segmentation</article-title>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Maxim</surname>
            <given-names>Berman</given-names>
          </string-name>
          , Amal Rannen Triki, and
          <string-name>
            <surname>Matthew</surname>
            <given-names>B.</given-names>
          </string-name>
          <string-name>
            <surname>Blaschko</surname>
          </string-name>
          .
          <article-title>The lovsz-softmax loss: A tractable surrogate for the optimization of the intersection-over-union measure in neural networks</article-title>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>E. Khvedchenya V. I. Iglovikov A.</given-names>
            <surname>Buslaev</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Parinov</surname>
          </string-name>
          and
          <string-name>
            <given-names>A. A.</given-names>
            <surname>Kalinin</surname>
          </string-name>
          .
          <article-title>Albumentations: fast and flexible image augmentations</article-title>
          .
          <source>ArXiv</source>
          e-prints,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>Ilya</given-names>
            <surname>Loshchilov</surname>
          </string-name>
          and
          <string-name>
            <given-names>Frank</given-names>
            <surname>Hutter</surname>
          </string-name>
          .
          <article-title>SGDR: stochastic gradient descent with restarts</article-title>
          .
          <source>CoRR, abs/1608.03983</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [13]
          <string-name>
            <surname>Olaf</surname>
            <given-names>Ronneberger</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Philipp</given-names>
            <surname>Fischer</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Thomas</given-names>
            <surname>Brox</surname>
          </string-name>
          .
          <article-title>U-net: Convolutional networks for biomedical image segmentation</article-title>
          .
          <source>In Medical Image Computing and Computer-Assisted Intervention -MICCAI</source>
          <year>2015</year>
          , pages
          <fpage>234</fpage>
          -
          <lpage>241</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>