<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Algorithm | Alan Hung</title>
    <link>https://alanhung.dev/tag/algorithm/</link>
      <atom:link href="https://alanhung.dev/tag/algorithm/index.xml" rel="self" type="application/rss+xml" />
    <description>Algorithm</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>Algorithm</title>
      <link>https://alanhung.dev/tag/algorithm/</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>
    
    <item>
      <title>Color Theme Extraction Based on the Bucket Sort Algorithm</title>
      <link>https://alanhung.dev/project/color-theme-extraction/</link>
      <pubDate>Wed, 05 Jul 2017 00:00:00 +0000</pubDate>
      <guid>https://alanhung.dev/project/color-theme-extraction/</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-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-color-conversion&#34;&gt;3.1. Color Conversion&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&#34;#32-quantitative-definition-of-a-theme&#34;&gt;3.2. Quantitative definition of a theme&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&#34;#33-search-algorithm&#34;&gt;3.3. Search algorithm&lt;/a&gt;
          &lt;ul&gt;
            &lt;li&gt;&lt;a href=&#34;#331-naive-approach&#34;&gt;3.3.1. Naive approach&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href=&#34;#332-optimized-approach-using-bucket-sort&#34;&gt;3.3.2. Optimized approach using Bucket sort&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&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 present an algorithm for extracting color themes from digital images, which is crucial for automating the design process. The algorithm uses the HSV color space and a bucket sort with binary search to achieve up to 98% accuracy on a dataset of 113 images with a runtime of 157 milliseconds per image, representing a 63x gain in runtime compared to human processing.&lt;/p&gt;
&lt;h1 id=&#34;1-introduction&#34;&gt;1. Introduction&lt;/h1&gt;
&lt;p&gt;Color is a primary factor in product design and significantly impacts various areas, including sales, marketing, and customer emotions




&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;#sigh-2006&#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;Satyendra&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Sigh&lt;/span&gt;&lt;/span&gt;,&amp;#32;&lt;span itemprop=&#34;datePublished&#34;&gt;2006&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;Sigh&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Satyendra&#34; /&gt;
    S.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2006&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;Impact of color on marketing&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;Management decision&lt;/span&gt;,&amp;#32;44(6)&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;783–789&lt;/span&gt;.&lt;/span&gt;




&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;
. While it may seem like a color palette is subjective and only related to personal preference, designers actually rely heavily on color theory to make their decisions.&lt;/p&gt;
&lt;p&gt;Modern color theory is largely based on Isaac Newton&amp;rsquo;s color wheel




&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;#newton-1730&#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;Isaac&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Newton&lt;/span&gt;&lt;/span&gt;,&amp;#32;&lt;span itemprop=&#34;datePublished&#34;&gt;1730&lt;/span&gt;&lt;/a&gt;&lt;span class=&#34;hugo-cite-citation&#34;&gt; 










&lt;span itemscope 
      itemtype=&#34;https://schema.org/Book&#34;
      data-type=&#34;book&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Newton&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Isaac&#34; /&gt;
    I.&lt;/span&gt;&amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;1730&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;
    &lt;i&gt;Opticks: Or, A Treatise of the Reflections, Refractions, Inflections and Colours of Light&lt;/i&gt;&lt;/span&gt;.
  &amp;#32;
  &lt;span itemprop=&#34;publisher&#34;
             itemtype=&#34;http://schema.org/Organization&#34;
             itemscope=&#34;&#34;&gt;
    &lt;span itemprop=&#34;name&#34;&gt;William Innys at the West-End of St.Paul&amp;#39;s&lt;/span&gt;&lt;/span&gt;.&lt;/span&gt;




&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;
, which illustrates the relationship between colors. Unlike RGB, the color wheel is in the HSV color space, which is essentially a cylindrical coordinate system where hue, saturation, and value are related to degree, radius, and height, respectively. The cross-section of the cylinder represents the color wheel.&lt;/p&gt;
&lt;p&gt;Color themes are combinations of colors on the color wheel. For example, as shown in Fig. 1, an analogous color theme can be created by selecting adjacent colors, while a complementary color theme consists of two colors that are directly across from each other.
&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;
            Relative position of colors for different themes.
        &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-size6 respon5 p-l-2 p-r-2&#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;Analogous&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;analogous&#34;&gt;&lt;/div&gt;
            &lt;/figure&gt;
&lt;/div&gt;

        
&lt;/div&gt;

        &lt;div class=&#34;w-size6 respon5 p-l-2 p-r-2&#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;Complementary&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;complementary&#34;&gt;&lt;/div&gt;
            &lt;/figure&gt;
&lt;/div&gt;

        
&lt;/div&gt;

        &lt;div class=&#34;w-size6 respon5 p-l-2 p-r-2&#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;Triadic&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;triadic&#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;/p&gt;
&lt;h1 id=&#34;2-main-challenge&#34;&gt;2. Main challenge&lt;/h1&gt;
&lt;p&gt;When designing a product composed of different fabrics, the designer relies on color themes of each fabric, as shown in Fig. 2, which are manually extracted by other workers. This process is time-consuming and costly. &lt;span style=&#34;color:#FEAE00&#34;&gt;To expedite the design process, it is crucial to find a way to extract color themes automatically.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Although the theory behind color themes is mature and there are commercial tools available, such as &lt;a href=&#34;https://color.adobe.com/create/color-wheel&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Adobe Color Wheel&lt;/a&gt; and &lt;a href=&#34;https://www.pantone.com&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Pantone Connect&lt;/a&gt;, that can generate color themes or extract colors from imported images, &lt;span style=&#34;color:#FEAE00&#34;&gt;these tools are still unable to identify color themes directly from images and do not provide an API. As a result, automating the design process with these tools is impossible.&lt;/span&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;
            When designing a product, the designer should consider the color theme of the fabric. In this example, the complementary colors are dark green and pink. Therefore, the strap, zipper, and other fabric of the product should also match this color theme.
        &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/design_process.webp&#34; width=&#34;1080&#34; height=&#34;479&#34;&gt;

            &lt;/div&gt;
            

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

&lt;h1 id=&#34;3-program&#34;&gt;3. Program&lt;/h1&gt;
&lt;p&gt;To implement our own algorithm, the first step is to analyze the problem. This can be broken down into three parts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Converting the RGB channels of the digital image into HSV format.&lt;/li&gt;
&lt;li&gt;Defining color themes quantitatively.&lt;/li&gt;
&lt;li&gt;Implementing a search algorithm to check if colors match the defined themes.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;31-color-conversion&#34;&gt;3.1. Color Conversion&lt;/h2&gt;
&lt;p&gt;While it is possible to implement the conversion algorithm based on recent work




&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;#chernov-2015&#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;Vladimir&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Chernov&lt;/span&gt;&lt;/span&gt;,&amp;#32;&lt;span itemprop=&#34;datePublished&#34;&gt;2015&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;Chernov&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Vladimir&#34; /&gt;
    V.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2015&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;Integer-based accurate conversion between RGB and HSV color spaces&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;Computers &amp;amp; Electrical Engineering&lt;/span&gt;,&amp;#32;46&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;328–337&lt;/span&gt;.&lt;/span&gt;




&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;
, which claims to be faster and more accurate than classical methods. Conversion using an image processing package like OpenCV is already fast enough for our purposes.&lt;/p&gt;
&lt;h2 id=&#34;32-quantitative-definition-of-a-theme&#34;&gt;3.2. Quantitative definition of a theme&lt;/h2&gt;
&lt;p&gt;Since visual artwork rarely consists of only a single color, it is more appropriate to use intervals to describe a range of colors. By considering the relative position of each interval, we can define a theme. As a result, a color theme can be described using three parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The number of intervals&lt;/li&gt;
&lt;li&gt;The range of each interval&lt;/li&gt;
&lt;li&gt;The relative position of each interval&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example, in Fig. 1, the triadic theme consists of three intervals, each with a relative position of 120 degrees and a range that can start from 15 to 100.&lt;/p&gt;
&lt;h2 id=&#34;33-search-algorithm&#34;&gt;3.3. Search algorithm&lt;/h2&gt;
&lt;p&gt;Before delving into the algorithm, it is important to consider the constraints of the problem. According to the HSV color space, colors are confined to a range between 0 and 359. Additionally, in our dataset, we resize all images to 100 x 140 pixels, striking a balance between runtime and accuracy. Taking monochrome, analogous, complementary, and triadic themes into account, there are 22,680 possible themes when considering all combinations of numbers and ranges in intervals.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Constraints:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;0 ≤ color ≤ 359&lt;/li&gt;
&lt;li&gt;1 ≤ len(color) ≤ 14000&lt;/li&gt;
&lt;li&gt;len(theme) = 22680&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the following analysis, we use the notations 

$N$ and 

$K$ to represent the lengths of the &amp;ldquo;colors&amp;rdquo; and &amp;ldquo;themes&amp;rdquo; lists, respectively.&lt;/p&gt;
&lt;h3 id=&#34;331-naive-approach&#34;&gt;3.3.1. Naive approach&lt;/h3&gt;
&lt;p&gt;A naive approach would be to iterate through all colors and theme until finding the correct one. Here’s how the algorithm works:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Iterate through all themes.
&lt;ul&gt;
&lt;li&gt;At each iteration, we iterate through all colors.&lt;/li&gt;
&lt;li&gt;Check if theme covers all colors.
&lt;ul&gt;
&lt;li&gt;If it does, return it.&lt;/li&gt;
&lt;li&gt;Otherwise, we move on to the next one.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The time complexity is 

$O(NK)$. Although we need extra memory to store the number of colors in each interval during each iteration, the space complexity remains 

$O(1)$ since it only depends on the number of intervals in each theme.&lt;/p&gt;
&lt;h3 id=&#34;332-optimized-approach-using-bucket-sort&#34;&gt;3.3.2. Optimized approach using Bucket sort&lt;/h3&gt;
&lt;p&gt;Since there are upper and lower bound of color, the problem can be optimized using a bucket sort with binary search.&lt;/p&gt;
&lt;p&gt;Here’s the basic idea of the algorithm:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To divide the range of colors (0~360) into &amp;ldquo;buckets&amp;rdquo;, select a bucket size. For example, if the bucket size is 10, there will be 36 buckets in total.&lt;/li&gt;
&lt;li&gt;Iterate through each color and use binary search to find the correct bucket.&lt;/li&gt;
&lt;li&gt;Merge adjacent and non-empty buckets.&lt;/li&gt;
&lt;li&gt;Iterate through all themes.
&lt;ul&gt;
&lt;li&gt;At each iteration, iterate through all merged buckets.&lt;/li&gt;
&lt;li&gt;Check if the theme covers all buckets.
&lt;ul&gt;
&lt;li&gt;If it does, return it.&lt;/li&gt;
&lt;li&gt;Otherwise, move on to the next one.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Assuming that 

$B$ represents the number of buckets, the time complexity of this algorithm is 

$O(NlogB + BK)$, where 

$NlogB$ comes from bucket sort with binary search. The space complexity is 

$O(B)$. The bucket size is considered a hyperparameter. In practice, a bucket size of 5 or 10 is sufficient to obtain accurate results. As a result, this algorithm significantly improves speed compared to a naive approach.
&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 various search algorithms.
        &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-size13 respon5 p-l-2 p-r-2&#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) Naive approach&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-theme-brute-force&#34;&gt;&lt;/div&gt;
            &lt;button id=&#34;search-theme-brute-force-run&#34; style=&#34;color: #BB86FC;&#34;&gt;Run&lt;/button&gt;
            &lt;button id=&#34;search-theme-brute-force-reset&#34; style=&#34;color: #BB86FC;&#34;&gt;Reset&lt;/button&gt;
        &lt;/figure&gt;
&lt;/div&gt;

    
&lt;/div&gt;

    &lt;div class=&#34;w-size13 respon5 p-l-2 p-r-2&#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) Optimized approach with bucket sort&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-theme-bucket&#34;&gt;&lt;/div&gt;
            &lt;button id=&#34;search-theme-bucket-run&#34; style=&#34;color: #BB86FC;&#34;&gt;Run&lt;/button&gt;
            &lt;button id=&#34;search-theme-bucket-reset&#34; style=&#34;color: #BB86FC;&#34;&gt;Reset&lt;/button&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;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 3500 x 4900 pixels, as shown in Fig. 4. For the algorithm, we resized the images to 100 x 140 pixels and used a bucket size of 10.
&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 involving monochrome, analogous, complementary, and triadic color themes.
        &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/image_dataset.webp&#34; width=&#34;1560&#34; height=&#34;1080&#34;&gt;

            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;
&lt;/p&gt;
&lt;p&gt;To evaluate speed, we had humans judge the theme of each image using a commercial color picker and measured the time taken for each judgment. For accuracy evaluation, we used the human judgment results as the ground truth, as shown in Fig. 5.&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;
            To evaluate accuracy, we use human judgement as the ground truth. For instance, the algorithm extracted analogous, complementary, and triadic color themes from the following images, which match the result obtained from human judgement using a color picker.
        &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/experiment_result.webp&#34; width=&#34;1386&#34; height=&#34;1464&#34;&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;The algorithm only failed on 2 images, resulting in an accuracy of 98%. The reason for these failures is that the images are composed of multiple color themes. For example, the image in Fig. 6 is considered to be both complementary and analogous.
&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 algorithm fails to extract if the image is composed of multiple color themes.
        &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/failed_result.webp&#34; width=&#34;1386&#34; height=&#34;532&#34;&gt;

            &lt;/div&gt;
            

        &lt;/figure&gt;
    &lt;/div&gt;
    
&lt;/div&gt;
&lt;/p&gt;
&lt;p&gt;The comparison of runtime is shown in Fig. 7. Excluding the time for importing images, the average runtime for processing a single image is 157 milliseconds for the algorithm and 10 seconds for a human. This represents a 63x gain in runtime compared to human processing. For reference, a naive approach could take up to 30 seconds, which is even slower than human processing.
&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;
            By using an optimized approach in the search algorithm, the processing speed is 63 times faster than human processing. The unit of measurement for processing speed is images per second, and the plot is shown on a 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;p-t-10&#34;&gt;&lt;/div&gt;
        &lt;div id=&#34;search-theme-runtime-benchmark&#34; class=&#34;flex-sb&#34;&gt;
            &lt;div class=&#34;benchmark-col-0&#34;&gt;
                &lt;div id=&#34;search-theme-runtime-0-bar-chart&#34;&gt;
                &lt;/div&gt;
                &lt;p id=&#34;search-theme-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-theme-runtime-0-annotation&#34;&gt;1x&lt;/p&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div id=&#34;search-theme-runtime-benchmark&#34; class=&#34;flex-sb&#34;&gt;
            &lt;div class=&#34;benchmark-col-0&#34;&gt;
                &lt;div id=&#34;search-theme-runtime-1-bar-chart&#34;&gt;
                &lt;/div&gt;
                &lt;p id=&#34;search-theme-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-theme-runtime-1-annotation&#34;&gt;1x&lt;/p&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div id=&#34;search-theme-runtime-benchmark&#34; class=&#34;flex-sb&#34;&gt;
            &lt;div class=&#34;benchmark-col-0&#34;&gt;
                &lt;div id=&#34;search-theme-runtime-2-bar-chart&#34;&gt;
                &lt;/div&gt;
                &lt;p id=&#34;search-theme-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-theme-runtime-2-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;5-conclusion&#34;&gt;5. Conclusion&lt;/h1&gt;
&lt;p&gt;We have presented an algorithm for identifying color themes that does not require any training or human annotations. The algorithm is 63 times faster than human processing and achieves up to 98% accuracy 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;sigh-2006&#34;&gt;
        &lt;dt&gt;
          Sigh

          
          (2006)&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;Sigh&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Satyendra&#34; /&gt;
    S.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2006&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;Impact of color on marketing&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;Management decision&lt;/span&gt;,&amp;#32;44(6)&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;783–789&lt;/span&gt;.&lt;/span&gt;




&lt;/dd&gt;

      &lt;/div&gt;

      &lt;div id=&#34;newton-1730&#34;&gt;
        &lt;dt&gt;
          Newton

          
          (1730)&lt;/dt&gt;

        &lt;dd&gt;
          










&lt;span itemscope 
      itemtype=&#34;https://schema.org/Book&#34;
      data-type=&#34;book&#34;&gt;&lt;span itemprop=&#34;author&#34; itemscope itemtype=&#34;https://schema.org/Person&#34;&gt;&lt;span itemprop=&#34;familyName&#34;&gt;Newton&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Isaac&#34; /&gt;
    I.&lt;/span&gt;&amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;1730&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;
    &lt;i&gt;Opticks: Or, A Treatise of the Reflections, Refractions, Inflections and Colours of Light&lt;/i&gt;&lt;/span&gt;.
  &amp;#32;
  &lt;span itemprop=&#34;publisher&#34;
             itemtype=&#34;http://schema.org/Organization&#34;
             itemscope=&#34;&#34;&gt;
    &lt;span itemprop=&#34;name&#34;&gt;William Innys at the West-End of St.Paul&amp;#39;s&lt;/span&gt;&lt;/span&gt;.&lt;/span&gt;




&lt;/dd&gt;

      &lt;/div&gt;

      &lt;div id=&#34;chernov-2015&#34;&gt;
        &lt;dt&gt;
          Chernov

          
          (2015)&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;Chernov&lt;/span&gt;,&amp;#32;
    &lt;meta itemprop=&#34;givenName&#34; content=&#34;Vladimir&#34; /&gt;
    V.&lt;/span&gt;
  &amp;#32;
    (&lt;span itemprop=&#34;datePublished&#34;&gt;2015&lt;/span&gt;).
  &amp;#32;&lt;span itemprop=&#34;name&#34;&gt;Integer-based accurate conversion between RGB and HSV color spaces&lt;/span&gt;.&lt;i&gt;
    &lt;span itemprop=&#34;about&#34;&gt;Computers &amp;amp; Electrical Engineering&lt;/span&gt;,&amp;#32;46&lt;/i&gt;.&amp;#32;&lt;span itemprop=&#34;pagination&#34;&gt;328–337&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;searchThemeBruteForce({frameIndex: 0})&lt;/script&gt;
&lt;script&gt;searchThemeBucket({frameIndex: 0})&lt;/script&gt;
&lt;script&gt;searchThemeRunTime()&lt;/script&gt;
&lt;script&gt;analogous()&lt;/script&gt;
&lt;script&gt;complementary()&lt;/script&gt;
&lt;script&gt;triadic()&lt;/script&gt;
&lt;script&gt;
    figClosed({figuresIndex: [1, 2, 3, 4, 5, 6, 7], closeInner: true, closeOuter: true})
&lt;/script&gt;
</description>
    </item>
    
  </channel>
</rss>
