<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Computer vision | Alan Hung</title>
    <link>https://alanhung.dev/tag/computer-vision/</link>
      <atom:link href="https://alanhung.dev/tag/computer-vision/index.xml" rel="self" type="application/rss+xml" />
    <description>Computer vision</description>
    <generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Tue, 10 Jul 2018 00:00:00 +0000</lastBuildDate>
    <image>
      <url>https://alanhung.dev/media/icon_hu337733d8e3179de0d1b2aeaca0f6c335_54345_512x512_fill_lanczos_center_3.png</url>
      <title>Computer vision</title>
      <link>https://alanhung.dev/tag/computer-vision/</link>
    </image>
    
    <item>
      <title>Investigation of Algorithms for Retrieving Similar Images</title>
      <link>https://alanhung.dev/project/search-similar-fabric/</link>
      <pubDate>Tue, 10 Jul 2018 00:00:00 +0000</pubDate>
      <guid>https://alanhung.dev/project/search-similar-fabric/</guid>
      <description>&lt;script&gt;removeCoverImage()&lt;/script&gt;
&lt;details class=&#34;toc-inpage d-print-none  &#34; open&gt;
  &lt;summary class=&#34;font-weight-bold&#34;&gt;Table of Contents&lt;/summary&gt;
  &lt;nav id=&#34;TableOfContents&#34;&gt;
  &lt;ul&gt;
    &lt;li&gt;&lt;a href=&#34;#abstract&#34;&gt;Abstract&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#1-introduction&#34;&gt;1. Introduction&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#2-search-algorithm&#34;&gt;2. Search algorithm&lt;/a&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;a href=&#34;#21-per-pixel-measures-l_2-distance&#34;&gt;2.1. Per-pixel measures ($L_2$ distance)&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&#34;#22-k-nearest-neighbors-knn&#34;&gt;2.2. K-Nearest Neighbors (KNN)&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&#34;#23-perceptual-similarity-lpips&#34;&gt;2.3. Perceptual similarity (LPIPS)&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#3-experiments&#34;&gt;3. Experiments&lt;/a&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;a href=&#34;#31-dataset&#34;&gt;3.1. Dataset&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&#34;#32-result&#34;&gt;3.2. Result&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#4-application&#34;&gt;4. Application&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#5-conclusion&#34;&gt;5. Conclusion&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#reference&#34;&gt;Reference&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/nav&gt;
&lt;/details&gt;
&lt;p&gt;&lt;span id=&#34;milestones-of-business-model&#34;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;script&gt;notationMilestones()&lt;/script&gt;
&lt;h1 id=&#34;abstract&#34;&gt;Abstract&lt;/h1&gt;
&lt;p&gt;Automating the task of searching for similar images of fabric is crucial to improve efficiency in the fabric-related industry. Three algorithms were investigated in this project: per-pixel measures ($L_2$), K-Nearest Neighbors (KNN), and perceptual similarity (LPIPS). While LPIPS provides a better way to retrieve similar fabric as perceived by humans, its computational expense becomes a main obstacle when the number of images increases.&lt;/p&gt;
&lt;h1 id=&#34;1-introduction&#34;&gt;1. Introduction&lt;/h1&gt;
&lt;p&gt;Searching for similar images of fabric is a common task in the fabric-related industry. For instance, buyers may want to purchase fabrics similar to previous best-selling ones, while designers may want to experiment with different yet similar fabrics during the product design process.&lt;/p&gt;
&lt;p&gt;Although humans can recognize similar images effortlessly, traditionally, this task has relied on human search through all available fabrics to find a similar one, which is time-consuming and exhausting. Automating this procedure is crucial to improve efficiency.&lt;/p&gt;
&lt;h1 id=&#34;2-search-algorithm&#34;&gt;2. Search algorithm&lt;/h1&gt;
&lt;p&gt;Since we are searching through all images, we will use the notation $N$ to represent the total number of images in the following discussion.&lt;/p&gt;
&lt;h2 id=&#34;21-per-pixel-measures-l_2-distance&#34;&gt;2.1. Per-pixel measures ($L_2$ distance)&lt;/h2&gt;
&lt;p&gt;One of the classic methods for comparing images is to calculate the difference of every pixel using the $L_2$ distance. The time complexity is $O(N^2 * C * W * H)$, where $C$ represents the number of channels in the image, and $W$ and $H$ represent the width and height of the image, respectively. The space complexity is $O(N^2)$ because we need to store all the distances between the images.&lt;/p&gt;
&lt;h2 id=&#34;22-k-nearest-neighbors-knn&#34;&gt;2.2. K-Nearest Neighbors (KNN)&lt;/h2&gt;
&lt;p&gt;Rather than comparing the images directly, we can extract features from the image, such as the main color, &lt;a href=&#34;https://alanhung.dev/project/color-theme-extraction/&#34;&gt;color schemes&lt;/a&gt;, &lt;a href=&#34;https://alanhung.dev/project/repeated-pattern-detection/&#34;&gt;pattern size&lt;/a&gt;, and so on. Similarity can be defined as the $L_2$ distance between features. However, as the number of features increases, all samples may appear dissimilar, which is often referred to as the &amp;ldquo;curse of dimensionality&amp;rdquo;. To overcome this problem, we can &lt;a href=&#34;https://alanhung.dev/project/improve-fabric-sales/#51-dimensionality-reduction&#34;&gt;reduce the dimensionality using PCA&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The time complexity is $O(N^2 * K)$, where $K$ represents the number of principal components from PCA. The space complexity remains $O(N^2)$ since we store all distances.&lt;/p&gt;
&lt;h2 id=&#34;23-perceptual-similarity-lpips&#34;&gt;2.3. Perceptual similarity (LPIPS)&lt;/h2&gt;
&lt;p&gt;This method, which was published by Zhang




&lt;span class=&#34;hugo-cite-intext&#34;
        itemprop=&#34;citation&#34;&gt;(&lt;span class=&#34;hugo-cite-group&#34;&gt;

          &lt;a href=&#34;#zhang-2018&#34;&gt;&lt;span class=&#34;visually-hidden&#34;&gt;Citation: &lt;/span&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Richard&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Zhang&lt;/span&gt;&lt;/span&gt;,&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Phillip&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Isola&lt;/span&gt;&lt;/span&gt;
                  &lt;em&gt;&amp;amp; al.&lt;/em&gt;,&amp;#32;&lt;span itemprop=&#34;datePublished&#34;&gt;2018&lt;/span&gt;&lt;/a&gt;&lt;span class=&#34;hugo-cite-citation&#34;&gt; 










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Zhang&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Richard&#34; /&gt;
    R.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Isola&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Phillip&#34; /&gt;
    P.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Efros&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Alexei A&#34; /&gt;
    A.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Shechtman&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Eli&#34; /&gt;
    E.&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Wang&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Oliver&#34; /&gt;
    O.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2018&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;The unreasonable effectiveness of deep features as a perceptual metric&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;Proceedings of the IEEE conference on computer vision and pattern recognition&lt;/span&gt;&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;586–595&lt;/span&gt;.&lt;/span&gt;




&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;
 as shown in the Fig. 1, extracts feature maps from activation layers and calculates the weighted distance $d_0$ between those feature maps. To apply this method, we can push images $x$ and $x_0$ through a pre-trained network (such as AlexNet




&lt;span class=&#34;hugo-cite-intext&#34;
        itemprop=&#34;citation&#34;&gt;(&lt;span class=&#34;hugo-cite-group&#34;&gt;

          &lt;a href=&#34;#krizhevsky-2014&#34;&gt;&lt;span class=&#34;visually-hidden&#34;&gt;Citation: &lt;/span&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Alex&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Krizhevsky&lt;/span&gt;&lt;/span&gt;,&amp;#32;&lt;span itemprop=&#34;datePublished&#34;&gt;2014&lt;/span&gt;&lt;/a&gt;&lt;span class=&#34;hugo-cite-citation&#34;&gt; 










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Krizhevsky&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Alex&#34; /&gt;
    A.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2014&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;One weird trick for parallelizing convolutional neural networks&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;arXiv preprint arXiv:1404.5997&lt;/span&gt;&lt;/i&gt;.&lt;/span&gt;




&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;
), denoted as $F$.&lt;/p&gt;
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            Feature maps are extracted by passing images $x$ and $x_0$ through a pre-trained network $F$. The distance is computed by subtracting the feature maps and then calculating the spatial average of the $L_2$ norm.
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        &lt;img src=&#34;./figure/LPIPS.webp&#34; width=&#34;1080&#34; height=&#34;345&#34;&gt;
    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;

&lt;p&gt;Fig. 2 provides an example with AlexNet. When the input images exhibit visual differences, as in Fig. 2 &lt;strong&gt;(a)&lt;/strong&gt;, the spatial average result differs significantly from that of the similar input images in Figure Fig. 2 &lt;strong&gt;(b)&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            The following shows the spatial average results from ReLU activation layers in AlexNet, based on visually &lt;strong&gt;(a)&lt;/strong&gt; dissimilar  and &lt;strong&gt;(b)&lt;/strong&gt; similar  input images.
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        

&lt;div class=&#34;wrap-dropdown-content p-b-10 mdc-elevation--z24&#34;&gt;
    &lt;h6 class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 m-b-1 p-l-5 p-r-5&#34; style=&#34;font-size:18px;&#34;&gt;(a)&lt;i class=&#34;down-mark fs-12 color1 fa dis-none float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;show&lt;/i&gt;
        &lt;i class=&#34;up-mark fs-12 color1 fa float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;hide&lt;/i&gt;
    &lt;/h6&gt;
    &lt;figure class=&#34;dropdown-content dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;
        
            &lt;img src=&#34;./figure/LPIPS_not_similar.webp&#34; width=&#34;1506&#34; height=&#34;832&#34;&gt;
        &lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;


    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        

&lt;div class=&#34;wrap-dropdown-content p-b-10 mdc-elevation--z24&#34;&gt;
    &lt;h6 class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 m-b-1 p-l-5 p-r-5&#34; style=&#34;font-size:18px;&#34;&gt;(b)&lt;i class=&#34;down-mark fs-12 color1 fa dis-none float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;show&lt;/i&gt;
        &lt;i class=&#34;up-mark fs-12 color1 fa float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;hide&lt;/i&gt;
    &lt;/h6&gt;
    &lt;figure class=&#34;dropdown-content dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;
        
            &lt;img src=&#34;./figure/LPIPS_similar.webp&#34; width=&#34;1506&#34; height=&#34;832&#34;&gt;
        &lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;

&lt;p&gt;While this method is proven to be effective in finding similar images, it is computationally expensive. Depending on the architecture of the pre-trained network, which may involve multiple convolutional and pooling layers, the runtime may be significantly increased. In addition, we will need additional memory to store all feature maps from activation layers.&lt;/p&gt;
&lt;h1 id=&#34;3-experiments&#34;&gt;3. Experiments&lt;/h1&gt;
&lt;h2 id=&#34;31-dataset&#34;&gt;3.1. Dataset&lt;/h2&gt;
&lt;p&gt;We collected 113 digital images of fabric with dimensions of 30 cm x 42 cm (3500 x 4200 pixels), as shown in Fig. 3.
To test the algorithm&amp;rsquo;s ability to retrieve similar images, we randomly select images from the dataset, add spatial pixel shifts, and then put them back into the dataset. We then test whether the algorithm can retrieve them.
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            The dataset is used in experiments
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        &lt;img src=&#34;./figure/image_dataset.webp&#34; width=&#34;1560&#34; height=&#34;1080&#34;&gt;
    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;
&lt;/p&gt;
&lt;h2 id=&#34;32-result&#34;&gt;3.2. Result&lt;/h2&gt;
&lt;p&gt;As shown in the Fig. 4, the use of per-pixel measures ($L_2$) may fail to retrieve images with spatial pixel shift. This is because even a small shift can result in a large difference. In contrast, KNN and LPIPS rely solely on extracted features and can therefore successfully find those images.&lt;/p&gt;
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            Per-pixel measures ($L_2$) fail to retrieve images with spatial pixel shift, because even small shifts can generate large differences.
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        &lt;img src=&#34;./figure/comparison_211101_181X4Y.webp&#34; width=&#34;1092&#34; height=&#34;388&#34;&gt;
        &lt;p&gt;&lt;/p&gt;
        &lt;img src=&#34;./figure/comparison_210801_143X2Y.webp&#34; width=&#34;1092&#34; height=&#34;388&#34;&gt;
    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;

&lt;p&gt;However, due to the lack of spatial information in features, KNN might still fail to find images that are similar from a human perspective. As shown in the Fig. 5, the KNN algorithm retrieves images that are similar to the input image only in terms of colors. However, the context and structure of these images are entirely different.&lt;/p&gt;
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            Although the color of the retrieved image from KNN may be similar to the input, the structure and context can be different. Therefore, KNN may fail to find similar images due to the lack of spatial information in the features.
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        &lt;img src=&#34;./figure/comparison_210801_055X2Y.webp&#34; width=&#34;1092&#34; height=&#34;388&#34;&gt;
    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;

&lt;p&gt;As previously discussed, in terms of runtime (as shown in the Fig. 6), LPIPS is the most computationally expensive of the three algorithms, taking up to 8.3 seconds per image on our dataset.
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            Speed (images per second) is displayed on a logarithmic scale to compare different algorithms, with human processing used as the baseline.
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        &lt;p&gt;&lt;/p&gt;
        &lt;div id=&#34;search-images-runtime-benchmark&#34; class=&#34;flex-sb&#34;&gt;
            &lt;div class=&#34;benchmark-col-0&#34;&gt;
                &lt;div id=&#34;search-images-runtime-0-bar-chart&#34;&gt;
                &lt;/div&gt;
                &lt;p id=&#34;search-images-runtime-0-name&#34;&gt;name&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&#34;benchmark-col-1&#34;&gt;
                &lt;p id=&#34;search-images-runtime-0-annotation&#34;&gt;1x&lt;/p&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div id=&#34;search-images-runtime-benchmark&#34; class=&#34;flex-sb&#34;&gt;
            &lt;div class=&#34;benchmark-col-0&#34;&gt;
                &lt;div id=&#34;search-images-runtime-1-bar-chart&#34;&gt;
                &lt;/div&gt;
                &lt;p id=&#34;search-images-runtime-1-name&#34;&gt;name&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&#34;benchmark-col-1&#34;&gt;
                &lt;p id=&#34;search-images-runtime-1-annotation&#34;&gt;1x&lt;/p&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div id=&#34;search-images-runtime-benchmark&#34; class=&#34;flex-sb&#34;&gt;
            &lt;div class=&#34;benchmark-col-0&#34;&gt;
                &lt;div id=&#34;search-images-runtime-2-bar-chart&#34;&gt;
                &lt;/div&gt;
                &lt;p id=&#34;search-images-runtime-2-name&#34;&gt;name&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&#34;benchmark-col-1&#34;&gt;
                &lt;p id=&#34;search-images-runtime-2-annotation&#34;&gt;1x&lt;/p&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div id=&#34;search-images-runtime-benchmark&#34; class=&#34;flex-sb&#34;&gt;
            &lt;div class=&#34;benchmark-col-0&#34;&gt;
                &lt;div id=&#34;search-images-runtime-3-bar-chart&#34;&gt;
                &lt;/div&gt;
                &lt;p id=&#34;search-images-runtime-3-name&#34;&gt;name&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&#34;benchmark-col-1&#34;&gt;
                &lt;p id=&#34;search-images-runtime-3-annotation&#34;&gt;1x&lt;/p&gt;
            &lt;/div&gt;
        &lt;/div&gt;

    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;
&lt;/p&gt;
&lt;h1 id=&#34;4-application&#34;&gt;4. Application&lt;/h1&gt;
&lt;p&gt;To improve the efficiency of fabric searching, LPIPS with AlexNet has been implemented into the &lt;a href=&#34;https://demo.alanhung.dev/product/210801_005X2Y/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;in-house library&lt;/a&gt;, as shown in the Fig. 7. When a new image is imported, the algorithm retrieves similar fabrics and stores them in a database.&lt;/p&gt;
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            We have used LPIPS with AlexNet in our in-house library to retrieve similar fabric.
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        &lt;img src=&#34;./figure/library.webp&#34; width=&#34;1080&#34; height=&#34;1002&#34;&gt;
    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;

&lt;h1 id=&#34;5-conclusion&#34;&gt;5. Conclusion&lt;/h1&gt;
&lt;p&gt;Three algorithms were investigated in this project. The per-pixel measure ($L_2$) did not meet our requirements due to its sensitivity to pixel shift. Similarly, KNN is not applicable since the features lack spatial information. LPIPS provides a better way to retrieve similar fabric as perceived by humans, but its computational expense becomes a main obstacle when the number of images increases.&lt;/p&gt;
&lt;h1 id=&#34;reference&#34;&gt;Reference&lt;/h1&gt;











&lt;section class=&#34;hugo-cite-bibliography&#34;&gt;
  &lt;dl&gt;
    

      &lt;div id=&#34;zhang-2018&#34;&gt;
        &lt;dt&gt;
          Zhang,&amp;#32;
          Isola,&amp;#32;
          Efros,&amp;#32;
          Shechtman&amp;#32;&amp;amp;&amp;#32;Wang

          
          (2018)&lt;/dt&gt;

        &lt;dd&gt;
          










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Zhang&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Richard&#34; /&gt;
    R.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Isola&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Phillip&#34; /&gt;
    P.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Efros&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Alexei A&#34; /&gt;
    A.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Shechtman&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Eli&#34; /&gt;
    E.&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Wang&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Oliver&#34; /&gt;
    O.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2018&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;The unreasonable effectiveness of deep features as a perceptual metric&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;Proceedings of the IEEE conference on computer vision and pattern recognition&lt;/span&gt;&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;586–595&lt;/span&gt;.&lt;/span&gt;




&lt;/dd&gt;

      &lt;/div&gt;

      &lt;div id=&#34;krizhevsky-2014&#34;&gt;
        &lt;dt&gt;
          Krizhevsky

          
          (2014)&lt;/dt&gt;

        &lt;dd&gt;
          










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Krizhevsky&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Alex&#34; /&gt;
    A.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2014&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;One weird trick for parallelizing convolutional neural networks&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;arXiv preprint arXiv:1404.5997&lt;/span&gt;&lt;/i&gt;.&lt;/span&gt;




&lt;/dd&gt;

      &lt;/div&gt;
  &lt;/dl&gt;
&lt;/section&gt;



&lt;script type=&#34;text/javascript&#34; src=&#34;./js/plot.js&#34;&gt;&lt;/script&gt;
&lt;script&gt;
    figClosed({figuresIndex: [1, 2, 3, 4, 5, 6, 7], closeInner: true, closeOuter: true})
&lt;/script&gt;
</description>
    </item>
    
    <item>
      <title>Repeated Pattern Detection of Printed Fabric</title>
      <link>https://alanhung.dev/project/repeated-pattern-detection/</link>
      <pubDate>Thu, 01 Feb 2018 00:00:00 +0000</pubDate>
      <guid>https://alanhung.dev/project/repeated-pattern-detection/</guid>
      <description>&lt;details class=&#34;toc-inpage d-print-none  &#34; open&gt;
  &lt;summary class=&#34;font-weight-bold&#34;&gt;Table of Contents&lt;/summary&gt;
  &lt;nav id=&#34;TableOfContents&#34;&gt;
  &lt;ul&gt;
    &lt;li&gt;&lt;a href=&#34;#abstract&#34;&gt;Abstract&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#1-introduction&#34;&gt;1. Introduction&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#2-main-challenge&#34;&gt;2. Main challenge&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#3-program&#34;&gt;3. Program&lt;/a&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;a href=&#34;#31-approach-with-fourier-analysis&#34;&gt;3.1. Approach with Fourier analysis&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&#34;#32-approach-with-l_2-loss&#34;&gt;3.2. Approach with $L_2$ loss&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#4-experiment&#34;&gt;4. Experiment&lt;/a&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;a href=&#34;#41-dataset&#34;&gt;4.1. Dataset&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&#34;#42-result&#34;&gt;4.2. Result&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#5-conclusion&#34;&gt;5. Conclusion&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#reference&#34;&gt;Reference&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/nav&gt;
&lt;/details&gt;
&lt;p&gt;&lt;span id=&#34;milestones-of-business-model&#34;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;script&gt;notationMilestones()&lt;/script&gt;
&lt;h1 id=&#34;abstract&#34;&gt;Abstract&lt;/h1&gt;
&lt;p&gt;We study the problem of detecting repeated patterns. Our goal is to extract a single unit of repeated patterns from an input image. This problem can be simplified for printed fabric because of its strictly regular and fronto-parallel nature. Under these properties, we investigate two algorithms. The first one uses Fourier analysis, but it is not suitable for our purpose because it requires additional assumptions about the period of the image. The second algorithm involves shifting the image and calculating the distance using the 

$L_2$ loss function. This method can efficiently solve the problem compared to human processing on our dataset.&lt;/p&gt;
&lt;h1 id=&#34;1-introduction&#34;&gt;1. Introduction&lt;/h1&gt;
&lt;p&gt;Repeated patterns are prevalent, particularly in human-made objects, as illustrated in the Fig. 1 (a). They offer insights into the object, such as allowing us to estimate the number of floors and the structure of a building




&lt;span class=&#34;hugo-cite-intext&#34;
        itemprop=&#34;citation&#34;&gt;(&lt;span class=&#34;hugo-cite-group&#34;&gt;

          &lt;a href=&#34;#lettry-2017&#34;&gt;&lt;span class=&#34;visually-hidden&#34;&gt;Citation: &lt;/span&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Louis&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Lettry&lt;/span&gt;&lt;/span&gt;,&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Michal&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Perdoch&lt;/span&gt;&lt;/span&gt;
                  &lt;em&gt;&amp;amp; al.&lt;/em&gt;,&amp;#32;&lt;span itemprop=&#34;datePublished&#34;&gt;2017&lt;/span&gt;&lt;/a&gt;&lt;span class=&#34;hugo-cite-citation&#34;&gt; 










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Lettry&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Louis&#34; /&gt;
    L.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Perdoch&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Michal&#34; /&gt;
    M.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Vanhoey&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Kenneth&#34; /&gt;
    K.&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Van Gool&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Luc&#34; /&gt;
    L.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2017&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;Repeated pattern detection using CNN activations&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;2017 IEEE Winter Conference on Applications of Computer Vision (WACV)&lt;/span&gt;&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;47–55&lt;/span&gt;.&lt;/span&gt;




&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;
 or count the number of objects in an image




&lt;span class=&#34;hugo-cite-intext&#34;
        itemprop=&#34;citation&#34;&gt;(&lt;span class=&#34;hugo-cite-group&#34;&gt;

          &lt;a href=&#34;#park-2009&#34;&gt;&lt;span class=&#34;visually-hidden&#34;&gt;Citation: &lt;/span&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Minwoo&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Park&lt;/span&gt;&lt;/span&gt;,&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Kyle&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Brocklehurst&lt;/span&gt;&lt;/span&gt;
                  &lt;em&gt;&amp;amp; al.&lt;/em&gt;,&amp;#32;&lt;span itemprop=&#34;datePublished&#34;&gt;2009&lt;/span&gt;&lt;/a&gt;&lt;span class=&#34;hugo-cite-citation&#34;&gt; 










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Park&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Minwoo&#34; /&gt;
    M.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Brocklehurst&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Kyle&#34; /&gt;
    K.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Collins&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Robert T&#34; /&gt;
    R.&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Liu&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Yanxi&#34; /&gt;
    Y.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2009&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;Deformed lattice detection in real-world images using mean-shift belief propagation&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;IEEE Transactions on Pattern Analysis and Machine Intelligence&lt;/span&gt;,&amp;#32;31(10)&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;1804–1816&lt;/span&gt;.&lt;/span&gt;




&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;
.&lt;/p&gt;
&lt;p&gt;This is especially important for printed fabric in the textile industry, as it consists of repeated patterns in both the vertical and horizontal directions. Extraction a single pattern is useful in two ways. First, &lt;span style=&#34;color:#FEAE00&#34;&gt;It provides buyers with the minimum quantity necessary to purchase without having an incomplete pattern.&lt;/span&gt; For example, one could consider purchasing two units in the vertical direction to have two birds in opposite direction in a single pattern, as shown in the Fig. 1 (b). Second, &lt;span style=&#34;color:#FEAE00&#34;&gt;organizing a library by patterns can help designers find patterns more efficiently, ultimately speeding up the design process.&lt;/span&gt;
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            Detecting repeated patterns provides insights into objects. &lt;strong&gt;(a)&lt;/strong&gt; Information about the structure and number. &lt;strong&gt;(b)&lt;/strong&gt; Minimum quantity necessary to purchase without having an incomplete pattern.
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        

&lt;div class=&#34;wrap-dropdown-content p-b-10 mdc-elevation--z24&#34;&gt;
    &lt;h6 class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 m-b-1 p-l-5 p-r-5&#34; style=&#34;font-size:18px;&#34;&gt;(a)&lt;i class=&#34;down-mark fs-12 color1 fa dis-none float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;show&lt;/i&gt;
        &lt;i class=&#34;up-mark fs-12 color1 fa float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;hide&lt;/i&gt;
    &lt;/h6&gt;
    &lt;figure class=&#34;dropdown-content dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;
        
            &lt;img src=&#34;./figure/structure_number.webp&#34; width=&#34;1080&#34; height=&#34;392&#34;&gt;
        &lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;


    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        

&lt;div class=&#34;wrap-dropdown-content p-b-10 mdc-elevation--z24&#34;&gt;
    &lt;h6 class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 m-b-1 p-l-5 p-r-5&#34; style=&#34;font-size:18px;&#34;&gt;(b)&lt;i class=&#34;down-mark fs-12 color1 fa dis-none float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;show&lt;/i&gt;
        &lt;i class=&#34;up-mark fs-12 color1 fa float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;hide&lt;/i&gt;
    &lt;/h6&gt;
    &lt;figure class=&#34;dropdown-content dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;
        
            &lt;img src=&#34;./figure/dual_birds_fabric_pattern.webp&#34; width=&#34;1080&#34; height=&#34;770&#34;&gt;
        &lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;
&lt;/p&gt;
&lt;h1 id=&#34;2-main-challenge&#34;&gt;2. Main challenge&lt;/h1&gt;
&lt;p&gt;&lt;span style=&#34;color:#FEAE00&#34;&gt;Automating repetition detection remains a challenging task since the definition is unclear.&lt;/span&gt; For example, a checkerboard consisting of black and white has perfect repetition. However, it is often accompanied by irregularities, as shown in the Fig. 1 (a), the windows of the building are similar to each other, rather than being exactly the same in each pattern.&lt;/p&gt;
&lt;p&gt;Several algorithms have been developed to address this deviation




&lt;span class=&#34;hugo-cite-intext&#34;
        itemprop=&#34;citation&#34;&gt;(&lt;span class=&#34;hugo-cite-group&#34;&gt;

          &lt;a href=&#34;#liu-2004&#34;&gt;&lt;span class=&#34;visually-hidden&#34;&gt;Citation: &lt;/span&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Yanxi&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Liu&lt;/span&gt;&lt;/span&gt;,&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Robert T&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Collins&lt;/span&gt;&lt;/span&gt;
                  &lt;em&gt;&amp;amp; al.&lt;/em&gt;,&amp;#32;&lt;span itemprop=&#34;datePublished&#34;&gt;2004&lt;/span&gt;&lt;/a&gt;&lt;span class=&#34;hugo-cite-citation&#34;&gt; 










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Liu&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Yanxi&#34; /&gt;
    Y.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Collins&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Robert T&#34; /&gt;
    R.&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Tsin&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Yanghai&#34; /&gt;
    Y.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2004&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;A computational model for periodic pattern perception based on frieze and wallpaper groups&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;IEEE transactions on pattern analysis and machine intelligence&lt;/span&gt;,&amp;#32;26(3)&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;354–371&lt;/span&gt;.&lt;/span&gt;




&lt;/span&gt;&lt;/span&gt;;&amp;#32;&lt;span class=&#34;hugo-cite-group&#34;&gt;

          &lt;a href=&#34;#liu-2013&#34;&gt;&lt;span class=&#34;visually-hidden&#34;&gt;Citation: &lt;/span&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Jingchen&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Liu&lt;/span&gt;&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Yanxi&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Liu&lt;/span&gt;&lt;/span&gt;,&amp;#32;&lt;span itemprop=&#34;datePublished&#34;&gt;2013&lt;/span&gt;&lt;/a&gt;&lt;span class=&#34;hugo-cite-citation&#34;&gt; 










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Liu&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Jingchen&#34; /&gt;
    J.&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Liu&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Yanxi&#34; /&gt;
    Y.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2013&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;Grasp recurring patterns from a single view&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;Proceedings of the IEEE conference on computer vision and pattern recognition&lt;/span&gt;&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;2003–2010&lt;/span&gt;.&lt;/span&gt;




&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;
, while others make assumptions with a nearly regular pattern




&lt;span class=&#34;hugo-cite-intext&#34;
        itemprop=&#34;citation&#34;&gt;(&lt;span class=&#34;hugo-cite-group&#34;&gt;

          &lt;a href=&#34;#lettry-2017&#34;&gt;&lt;span class=&#34;visually-hidden&#34;&gt;Citation: &lt;/span&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Louis&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Lettry&lt;/span&gt;&lt;/span&gt;,&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;meta itemprop=&#34;givenName&#34; content=&#34;Michal&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Perdoch&lt;/span&gt;&lt;/span&gt;
                  &lt;em&gt;&amp;amp; al.&lt;/em&gt;,&amp;#32;&lt;span itemprop=&#34;datePublished&#34;&gt;2017&lt;/span&gt;&lt;/a&gt;&lt;span class=&#34;hugo-cite-citation&#34;&gt; 










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Lettry&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Louis&#34; /&gt;
    L.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Perdoch&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Michal&#34; /&gt;
    M.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Vanhoey&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Kenneth&#34; /&gt;
    K.&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Van Gool&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Luc&#34; /&gt;
    L.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2017&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;Repeated pattern detection using CNN activations&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;2017 IEEE Winter Conference on Applications of Computer Vision (WACV)&lt;/span&gt;&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;47–55&lt;/span&gt;.&lt;/span&gt;




&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;
. In other words,&lt;span style=&#34;color:#FEAE00&#34;&gt; assumptions are crucial for implementing an algorithm.&lt;/span&gt;&lt;/p&gt;
&lt;h1 id=&#34;3-program&#34;&gt;3. Program&lt;/h1&gt;
&lt;p&gt;Although it is a complex problem, fortunately, for our purposes, it is limited to printed fabric, which is both &lt;span style=&#34;color:#FEAE00&#34;&gt;strictly regular and fronto-parallel&lt;/span&gt; due to its manufacturing process. As a result, our problem is as simple as detecting the perfect repetition of a checkerboard. The problem&amp;rsquo;s constraint depends on the resolution of the image, which in our case is 3500 x 4200 pixels.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Constraints:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;len(pixels) = 3500 x 4200&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the following analysis, we will use the notation 

$N$ to represent the total number of pixels in an image.&lt;/p&gt;
&lt;h2 id=&#34;31-approach-with-fourier-analysis&#34;&gt;3.1. Approach with Fourier analysis&lt;/h2&gt;
&lt;p&gt;The intuitive method for identifying the period would be to use Fourier analysis, which is made efficient by using FFT. This results in a time complexity of 

$O(NlogN)$. However, since the basic idea behind Fourier analysis is an approximation by sums of simpler trigonometric functions, identifying the peak in spectrum can be challenging.&lt;/p&gt;
&lt;p&gt;For instance, let&amp;rsquo;s say we perform Fourier analysis in the horizontal direction of a checkerboard. As shown in the Fig. 2 (a), the frequency of the maximum power corresponds to the pattern consisting of a pair of black and white squares. If we reduce the contrast, as also depicted in the Fig. 2 (b), humans can still effortlessly identify the pattern. However, the position of the maximum power in the spectrum shifts to a lower frequency. In other words, to find the same pattern as that perceived by humans, we need to specify the search range in the spectrum. Nevertheless, since there is no certain range of periodicity for images, this approach is not practical.&lt;/p&gt;
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            Performing FFT on a checkerboard image with different contrasts reveals that in low contrast images, the pattern corresponding to the frequency of maximum power in the spectrum differs from what humans process. (Resolution of image is 250 x 2500 pixels)
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        

&lt;div class=&#34;wrap-dropdown-content p-b-10 mdc-elevation--z24&#34;&gt;
    &lt;h6 class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 m-b-1 p-l-5 p-r-5&#34; style=&#34;font-size:18px;&#34;&gt;(a)&lt;i class=&#34;down-mark fs-12 color1 fa dis-none float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;show&lt;/i&gt;
        &lt;i class=&#34;up-mark fs-12 color1 fa float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;hide&lt;/i&gt;
    &lt;/h6&gt;
    &lt;figure class=&#34;dropdown-content dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;
        
            &lt;img src=&#34;./figure/checkerboard-black-marked.png&#34; width=&#34;2500&#34; height=&#34;250&#34;&gt;
            &lt;div class=&#34;p-t-10&#34; id=&#34;checkerboard-black-spectrum&#34;&gt;&lt;/div&gt;
        &lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;


    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        

&lt;div class=&#34;wrap-dropdown-content p-b-10 mdc-elevation--z24&#34;&gt;
    &lt;h6 class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 m-b-1 p-l-5 p-r-5&#34; style=&#34;font-size:18px;&#34;&gt;(a)&lt;i class=&#34;down-mark fs-12 color1 fa dis-none float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;show&lt;/i&gt;
        &lt;i class=&#34;up-mark fs-12 color1 fa float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;hide&lt;/i&gt;
    &lt;/h6&gt;
    &lt;figure class=&#34;dropdown-content dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;
        
            &lt;img src=&#34;./figure/checkerboard-gray-marked.png&#34; width=&#34;2500&#34; height=&#34;250&#34;&gt;
            &lt;div class=&#34;p-t-10&#34; id=&#34;checkerboard-gray-spectrum&#34;&gt;&lt;/div&gt;
        &lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;

&lt;h2 id=&#34;32-approach-with-l_2-loss&#34;&gt;3.2. Approach with $L_2$ loss&lt;/h2&gt;
&lt;p&gt;This approach mimics human processing by sliding images to find their periodicity. In other words, it compares the pixels of images one by one, and uses the $L_2$ loss function as a metric for the distance between images. Here is how the algorithm works, as shown in the Fig. 3:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a copy of the original image.&lt;/li&gt;
&lt;li&gt;Fixed one image as a reference and slide another.
&lt;ul&gt;
&lt;li&gt;Calculate the loss in each RGB channel.&lt;/li&gt;
&lt;li&gt;Calculate the average loss for overlapped regions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Calculate the midpoint of the average loss function.&lt;/li&gt;
&lt;li&gt;Measure the distance between two midpoints while ascending or descending.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The size of the pattern can be extracted by performing the algorithm in both horizontal and vertical directions. The algorithm&amp;rsquo;s time complexity is $O(N^2)$ since we need to iterate through all pixels in each iteration. The space complexity is $O(N)$ because we create a copy of the original image.&lt;/p&gt;
&lt;p&gt;Although the algorithm is $N^2$, all elements share the same computation at every step. Therefore, we can take advantage of vectorization by using Numpy. Additionally, it is necessary to resize the image for the algorithm, which involves a trade-off between runtime and accuracy.&lt;/p&gt;
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            Animation of the algorithm with $L_2$ loss.
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        &lt;div id=&#34;search-pattern&#34; style=&#34;background-image: url(&#39;./figure/figure_01.webp&#39;); background-size: 100%; background-repeat: no-repeat; overflow: hidden;&#34;&gt;
            &lt;img id=&#34;search-pattern-brute-force-fig&#34; src=&#34;./figure/figure_02.webp&#34; width=&#34;1080px&#34; height=&#34;763px&#34; style=&#34;opacity: 0.5; margin-left:0; margin-right:0; position:relative; left:0;&#34;&gt;
        &lt;/div&gt;
        &lt;div id=&#34;search-pattern-brute-force&#34;&gt;&lt;/div&gt;
        &lt;button id=&#34;search-pattern-brute-force-run&#34; style=&#34;color: #BB86FC;&#34;&gt;Run&lt;/button&gt;
        &lt;button id=&#34;search-pattern-brute-force-reset&#34; style=&#34;color: #BB86FC;&#34;&gt;Reset&lt;/button&gt;
    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;

&lt;h1 id=&#34;4-experiment&#34;&gt;4. Experiment&lt;/h1&gt;
&lt;h2 id=&#34;41-dataset&#34;&gt;4.1. Dataset&lt;/h2&gt;
&lt;p&gt;To test the speed and accuracy of our algorithm, we collected 113 digital images of fabric with dimensions of 30 cm x 42 cm (3500 x 4200 pixels), as shown in Fig. 4 (a). The pattern size was extracted manually using the same method as the algorithm, which involved shifting and comparing the image. The distributions of pattern size are shown in Fig . 4 (b)(c).&lt;/p&gt;
&lt;p&gt;To evaluate speed, we had humans judge the pattern size of each image and measured the time taken for each judgment. For accuracy evaluation, we used the human judgment results as the ground truth.&lt;/p&gt;
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;strong&gt;(a)&lt;/strong&gt; The dataset is used in experiments. Distribution of pattern size in the &lt;strong&gt;(b)&lt;/strong&gt; horizontal and &lt;strong&gt;(c)&lt;/strong&gt; vertical direction.
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
            

&lt;div class=&#34;wrap-dropdown-content p-b-10 mdc-elevation--z24&#34;&gt;
    &lt;h6 class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 m-b-1 p-l-5 p-r-5&#34; style=&#34;font-size:18px;&#34;&gt;(a)&lt;i class=&#34;down-mark fs-12 color1 fa dis-none float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;show&lt;/i&gt;
        &lt;i class=&#34;up-mark fs-12 color1 fa float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;hide&lt;/i&gt;
    &lt;/h6&gt;
    &lt;figure class=&#34;dropdown-content dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;
        
                &lt;img src=&#34;./figure/image_dataset.webp&#34; width=&#34;1560&#34; height=&#34;1080&#34;&gt;
            &lt;figcaption&gt;
              
            &lt;/figcaption&gt;&lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;


    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
            

&lt;div class=&#34;wrap-dropdown-content p-b-10 mdc-elevation--z24&#34;&gt;
    &lt;h6 class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 m-b-1 p-l-5 p-r-5&#34; style=&#34;font-size:18px;&#34;&gt;(b)&lt;i class=&#34;down-mark fs-12 color1 fa dis-none float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;show&lt;/i&gt;
        &lt;i class=&#34;up-mark fs-12 color1 fa float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;hide&lt;/i&gt;
    &lt;/h6&gt;
    &lt;figure class=&#34;dropdown-content dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;
        
                &lt;div id=&#34;pattern-size-x&#34;&gt;&lt;/div&gt;
            &lt;figcaption&gt;
              
            &lt;/figcaption&gt;&lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;


    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
            

&lt;div class=&#34;wrap-dropdown-content p-b-10 mdc-elevation--z24&#34;&gt;
    &lt;h6 class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 m-b-1 p-l-5 p-r-5&#34; style=&#34;font-size:18px;&#34;&gt;(c)&lt;i class=&#34;down-mark fs-12 color1 fa dis-none float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;show&lt;/i&gt;
        &lt;i class=&#34;up-mark fs-12 color1 fa float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;hide&lt;/i&gt;
    &lt;/h6&gt;
    &lt;figure class=&#34;dropdown-content dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;
        
                &lt;div id=&#34;pattern-size-y&#34;&gt;&lt;/div&gt;
            &lt;figcaption&gt;
              
            &lt;/figcaption&gt;&lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;

&lt;h2 id=&#34;42-result&#34;&gt;4.2. Result&lt;/h2&gt;
&lt;p&gt;Fig. 5 provides examples of repeated patterns extracted from fabric. Fig. 6 (a) shows the results of runtime and accuracy, with both increasing as the resolution increases. At a resolution of 300 x 420 pixels, accuracy reaches 100% and runtime is 2.49 seconds. While the runtime is significantly longer than at 100 x 140 pixels, the algorithm still outperforms human processing, which takes 30 seconds per image. Therefore, the algorithm is 12 times faster than human processing, as shown in Fig. 6 (b).&lt;/p&gt;
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            Example of repeated patterns extracted in fabric.
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;img src=&#34;./figure/pattern_demo.webp&#34; width=&#34;1080&#34; height=&#34;778&#34;&gt;

            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;
&lt;div class=&#34;respon5 bo11 mdc-elevation--z24&#34;&gt;
    
    &lt;div class=&#34;wrap-dropdown-content p-b-10&#34;&gt;
        &lt;h5 data-pre=&#34;Figure&amp;nbsp;&#34;
            data-post=&#34;:&amp;nbsp;&#34;
            class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 p-l-15 p-r-15 numbered&#34;
            style=&#34;font-weight: normal;&#34;
        &gt;
            &lt;i class=&#34;down-mark fs-16 color1 fa fa-plus float-r dis-none&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;i class=&#34;up-mark fs-16 color1 fa fa-minus float-r&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;
            &lt;strong&gt;(a)&lt;/strong&gt; Both the accuracy and runtime increase as the resolution increases. &lt;strong&gt;(b)&lt;/strong&gt; At 300 x 420 pixels, the algorithm achieves 100% accuracy and is 12 times faster than human processing. (plot is shown in log scale)
        &lt;/h5&gt;
        &lt;figure class=&#34;dropdown-content p-l-15 p-r-15 dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;

            
            &lt;div class=&#34;flex-w flex-sb p-l-2 p-r-2&#34;&gt;
                
    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        

&lt;div class=&#34;wrap-dropdown-content p-b-10 mdc-elevation--z24&#34;&gt;
    &lt;h6 class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 m-b-1 p-l-5 p-r-5&#34; style=&#34;font-size:18px;&#34;&gt;(a)&lt;i class=&#34;down-mark fs-12 color1 fa dis-none float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;show&lt;/i&gt;
        &lt;i class=&#34;up-mark fs-12 color1 fa float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;hide&lt;/i&gt;
    &lt;/h6&gt;
    &lt;figure class=&#34;dropdown-content dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;
        
            &lt;div id=&#34;accuracy-runtime-plot&#34;&gt;&lt;/div&gt;
        &lt;figcaption&gt;
              
            &lt;/figcaption&gt;&lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;


    &lt;div class=&#34;w-size29 respon5&#34;&gt;
  
        

&lt;div class=&#34;wrap-dropdown-content p-b-10 mdc-elevation--z24&#34;&gt;
    &lt;h6 class=&#34;js-toggle-dropdown-content cs-pointer m-text29 color0-hov trans-0-4 m-b-1 p-l-5 p-r-5&#34; style=&#34;font-size:18px;&#34;&gt;(b)&lt;i class=&#34;down-mark fs-12 color1 fa dis-none float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;show&lt;/i&gt;
        &lt;i class=&#34;up-mark fs-12 color1 fa float-r m-text29&#34; aria-hidden=&#34;true&#34;&gt;hide&lt;/i&gt;
    &lt;/h6&gt;
    &lt;figure class=&#34;dropdown-content dis-block&#34; style=&#34;margin-top:0; margin-bottom:0&#34;&gt;
        
            &lt;div id=&#34;search-pattern-runtime-benchmark&#34; class=&#34;flex-sb&#34;&gt;
                &lt;div class=&#34;benchmark-col-0&#34;&gt;
                    &lt;div id=&#34;search-pattern-runtime-0-bar-chart&#34;&gt;
                    &lt;/div&gt;
                    &lt;p id=&#34;search-pattern-runtime-0-name&#34;&gt;name&lt;/p&gt;
                &lt;/div&gt;
                &lt;div class=&#34;benchmark-col-1&#34;&gt;
                    &lt;p id=&#34;search-pattern-runtime-0-annotation&#34;&gt;1x&lt;/p&gt;
                &lt;/div&gt;
            &lt;/div&gt;

            &lt;div id=&#34;search-pattern-runtime-benchmark&#34; class=&#34;flex-sb&#34;&gt;
                &lt;div class=&#34;benchmark-col-0&#34;&gt;
                    &lt;div id=&#34;search-pattern-runtime-1-bar-chart&#34;&gt;
                    &lt;/div&gt;
                    &lt;p id=&#34;search-pattern-runtime-1-name&#34;&gt;name&lt;/p&gt;
                &lt;/div&gt;
                &lt;div class=&#34;benchmark-col-1&#34;&gt;
                    &lt;p id=&#34;search-pattern-runtime-1-annotation&#34;&gt;1x&lt;/p&gt;
                &lt;/div&gt;
            &lt;/div&gt;

        &lt;figcaption&gt;
              
            &lt;/figcaption&gt;&lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;



            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;

&lt;h1 id=&#34;5-conclusion&#34;&gt;5. Conclusion&lt;/h1&gt;
&lt;p&gt;We present two approaches for detecting repetition in images. The first approach is based on Fourier analysis, but it is not suitable for our application because it requires additional assumptions about the range of the periods of images. The second approach emulates human processing by shifting and comparing images using the $L_2$ loss function. Despite its time complexity being $O(N^2)$, it outperforms human processing on our dataset.&lt;/p&gt;
&lt;h1 id=&#34;reference&#34;&gt;Reference&lt;/h1&gt;











&lt;section class=&#34;hugo-cite-bibliography&#34;&gt;
  &lt;dl&gt;
    

      &lt;div id=&#34;lettry-2017&#34;&gt;
        &lt;dt&gt;
          Lettry,&amp;#32;
          Perdoch,&amp;#32;
          Vanhoey&amp;#32;&amp;amp;&amp;#32;Van Gool

          
          (2017)&lt;/dt&gt;

        &lt;dd&gt;
          










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Lettry&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Louis&#34; /&gt;
    L.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Perdoch&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Michal&#34; /&gt;
    M.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Vanhoey&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Kenneth&#34; /&gt;
    K.&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Van Gool&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Luc&#34; /&gt;
    L.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2017&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;Repeated pattern detection using CNN activations&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;2017 IEEE Winter Conference on Applications of Computer Vision (WACV)&lt;/span&gt;&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;47–55&lt;/span&gt;.&lt;/span&gt;




&lt;/dd&gt;

      &lt;/div&gt;

      &lt;div id=&#34;park-2009&#34;&gt;
        &lt;dt&gt;
          Park,&amp;#32;
          Brocklehurst,&amp;#32;
          Collins&amp;#32;&amp;amp;&amp;#32;Liu

          
          (2009)&lt;/dt&gt;

        &lt;dd&gt;
          










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Park&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Minwoo&#34; /&gt;
    M.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Brocklehurst&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Kyle&#34; /&gt;
    K.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Collins&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Robert T&#34; /&gt;
    R.&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Liu&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Yanxi&#34; /&gt;
    Y.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2009&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;Deformed lattice detection in real-world images using mean-shift belief propagation&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;IEEE Transactions on Pattern Analysis and Machine Intelligence&lt;/span&gt;,&amp;#32;31(10)&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;1804–1816&lt;/span&gt;.&lt;/span&gt;




&lt;/dd&gt;

      &lt;/div&gt;

      &lt;div id=&#34;liu-2013&#34;&gt;
        &lt;dt&gt;
          Liu&amp;#32;&amp;amp;&amp;#32;Liu

          
          (2013)&lt;/dt&gt;

        &lt;dd&gt;
          










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Liu&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Jingchen&#34; /&gt;
    J.&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Liu&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Yanxi&#34; /&gt;
    Y.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2013&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;Grasp recurring patterns from a single view&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;Proceedings of the IEEE conference on computer vision and pattern recognition&lt;/span&gt;&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;2003–2010&lt;/span&gt;.&lt;/span&gt;




&lt;/dd&gt;

      &lt;/div&gt;

      &lt;div id=&#34;liu-2004&#34;&gt;
        &lt;dt&gt;
          Liu,&amp;#32;
          Collins&amp;#32;&amp;amp;&amp;#32;Tsin

          
          (2004)&lt;/dt&gt;

        &lt;dd&gt;
          










&lt;span itemscope
      itemtype=&#34;https://schema.org/Article&#34;
      data-type=&#34;article&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Liu&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Yanxi&#34; /&gt;
    Y.&lt;/span&gt;,&amp;#32;
  &lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Collins&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Robert T&#34; /&gt;
    R.&lt;/span&gt;&amp;#32;&amp;amp;&amp;#32;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Tsin&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Yanghai&#34; /&gt;
    Y.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2004&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;A computational model for periodic pattern perception based on frieze and wallpaper groups&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;IEEE transactions on pattern analysis and machine intelligence&lt;/span&gt;,&amp;#32;26(3)&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;354–371&lt;/span&gt;.&lt;/span&gt;




&lt;/dd&gt;

      &lt;/div&gt;
  &lt;/dl&gt;
&lt;/section&gt;



&lt;script type=&#34;text/javascript&#34; src=&#34;./js/plot.js&#34;&gt;&lt;/script&gt;
&lt;script&gt;
    figClosed({figuresIndex: [1, 2, 3, 4, 5, 6], closeInner: true, closeOuter: true})
&lt;/script&gt;
</description>
    </item>
    
  </channel>
</rss>
