Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app.py +12 -5
- generated_image.jpg +0 -0
- real_image.jpg +0 -0
app.py
CHANGED
@@ -27,11 +27,10 @@ def main():
|
|
27 |
st.markdown(
|
28 |
"""
|
29 |
<h3 style='text-align: center;'>Jewellery Font Type Detection - Proposed Solution Demo</h3>
|
30 |
-
|
31 |
-
<p>The challenge is to identify the correct order ID from a list by using both the OCR detected text and font type of custom-made jewelry.</p>
|
32 |
|
33 |
<h4>Proposed Solution</h4>
|
34 |
-
<p>
|
35 |
|
36 |
<p>There are two potential solutions to overcome this challenge:</p>
|
37 |
|
@@ -41,6 +40,7 @@ def main():
|
|
41 |
<h5>Solution 2</h5>
|
42 |
<p>Use Photoshop batch actions to create thousands of realistic images.</p>
|
43 |
|
|
|
44 |
""", unsafe_allow_html=True
|
45 |
)
|
46 |
|
@@ -50,7 +50,7 @@ def main():
|
|
50 |
st.image('otsu.PNG', use_column_width=True)
|
51 |
|
52 |
with col3:
|
53 |
-
st.markdown("""<p>
|
54 |
<p>Otsu's method assumes that the image contains two distinct intensity distributions, corresponding to the foreground and background regions.
|
55 |
It calculates the threshold that minimizes the intra-class variance or maximizes the inter-class variance.
|
56 |
By choosing the threshold that maximizes the inter-class variance, Otsu's thresholding effectively separates the two classes, resulting in a binary image.</p> """, unsafe_allow_html=True)
|
@@ -68,7 +68,14 @@ def main():
|
|
68 |
By using RANSAC to estimate the homography between the matched keypoints, we can eliminate outliers and improve the accuracy of the registration process.</P>
|
69 |
""", unsafe_allow_html=True)
|
70 |
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
st.markdown(colab_link, unsafe_allow_html=True)
|
73 |
|
74 |
|
|
|
27 |
st.markdown(
|
28 |
"""
|
29 |
<h3 style='text-align: center;'>Jewellery Font Type Detection - Proposed Solution Demo</h3>
|
30 |
+
|
|
|
31 |
|
32 |
<h4>Proposed Solution</h4>
|
33 |
+
<p>One solution involves bolstering an OCR engine with a custom-trained CNN for font type classification. In this demo, I have trained two custom CNNs to classify 21 font types using a synthetic dataset of 4000 images for each font, generated using NumPy, PIL, and OpenCV. The dataset consists of text images rendered with different fonts, utilizing variations in font size and positioning to create diversity. However, training an accurate custom CNN for the given problem requires thousands of images due to the similar nature of the font types used in custom jewelry.</p>
|
34 |
|
35 |
<p>There are two potential solutions to overcome this challenge:</p>
|
36 |
|
|
|
40 |
<h5>Solution 2</h5>
|
41 |
<p>Use Photoshop batch actions to create thousands of realistic images.</p>
|
42 |
|
43 |
+
<p> Alternatly use a feature matching algorithm as implemented in FLANN matching tab </p>
|
44 |
""", unsafe_allow_html=True
|
45 |
)
|
46 |
|
|
|
50 |
st.image('otsu.PNG', use_column_width=True)
|
51 |
|
52 |
with col3:
|
53 |
+
st.markdown("""<p>Otsu thresholding can pre-process images to a similar level of a synthetic dataset. See the image :</p>
|
54 |
<p>Otsu's method assumes that the image contains two distinct intensity distributions, corresponding to the foreground and background regions.
|
55 |
It calculates the threshold that minimizes the intra-class variance or maximizes the inter-class variance.
|
56 |
By choosing the threshold that maximizes the inter-class variance, Otsu's thresholding effectively separates the two classes, resulting in a binary image.</p> """, unsafe_allow_html=True)
|
|
|
68 |
By using RANSAC to estimate the homography between the matched keypoints, we can eliminate outliers and improve the accuracy of the registration process.</P>
|
69 |
""", unsafe_allow_html=True)
|
70 |
|
71 |
+
col5, col6 = st.columns(2)
|
72 |
+
with col5:
|
73 |
+
st.image('real_image.jpg', caption = 'A sample image with Otsu thresholding applied', width = 100)
|
74 |
+
|
75 |
+
with col6:
|
76 |
+
st.image('generated_image.jpg', caption = 'A generatated image', width = 100)
|
77 |
+
|
78 |
+
colab_link = '[<img src="https://colab.research.google.com/assets/colab-badge.svg">](https://colab.research.google.com/drive/11aO-QNRl2qMK0tgJ03RvcRLUuUSPvWMc?usp=sharing)'
|
79 |
st.markdown(colab_link, unsafe_allow_html=True)
|
80 |
|
81 |
|
generated_image.jpg
ADDED
![]() |
real_image.jpg
ADDED
![]() |