Lauzhack Demo

Initialization

In [2]:
from main import *
from utils import *
from demo import *
D=readStoreLogos()
In [2]:
images = showLogoImages(D)
for img in images:
    showarray(img)

Image Processing

In [4]:
img_file = "2017-01-20 - Lidl.png"
receipt = Receipt(img_file)
raw_img = loadImage(receipt.filename)
(denoised_img, final_img) = preprocessImg(raw_img, return_intermediate=True)
receipt.img = final_img
separator = 220 * np.ones((raw_img.shape[0], 20))
img = np.concatenate([raw_img, separator, denoised_img, separator, final_img], axis=1)
showarray(img)
In [5]:
compute_connected_components(receipt)
receipt.patches = compute_image_patches(receipt)
colorImg = showImageWithBoundingBoxes(receipt)
showarray(colorImg)

Full Information for an item

In [5]:
receipt = parseReceipt("2017-01-20 - Lidl.png", D, verbose = True, parseItems = True)
Comparison Scores
            Karstadt 0.400200
                Lidl 0.999071
                  dm 0.371567
   Karstadt Feinkost 0.220544
              TKMaxx 0.312630
           Aldi Sued 0.245782
              Oishii 0.437899
             Rossman 0.295056
     Galeria Kaufhof 0.318470
             Primark 0.230495
--- 17.825 seconds ---

--- Receipt ---
Store: Lidl
Date:  20.01.18
Paid:  15,97

Items:
                                  H-Milch 3,5% OGT       4 x  3,12, VAT A
                                  Cashewkerne 200g            2,89, VAT A
                                Paprika rot, spitz            1,69, VAT A
                                          Zitranen            0,95, VAT A
                                          Broccoli            0,37, VAT A
                                    Blumenzwiebeln            2,99, VAT A
                              Eier aus Rheinl.-Pf.            1,09, VAT A
                             Schinkenwiirstch. Ser   2 x 1,09 2,18, VAT A
                                   Schlagsahne 30K            0,69, VAT A

Other Items

In [ ]:
test_all_items(D, MIXED_LIST)
--- 0.015 seconds ---
Comparison Scores
            Karstadt 0.400200
                Lidl 0.999071
                  dm 0.371567
   Karstadt Feinkost 0.220544
              TKMaxx 0.312630
           Aldi Sued 0.245782
              Oishii 0.437899
             Rossman 0.295056
     Galeria Kaufhof 0.318470
             Primark 0.230495
--- 19.539 seconds ---

--- Receipt ---
Store: Lidl
Date:  20.01.18
Paid:  15,97

Items:
                                  H-Milch 3,5% OGT       4 x  3,12, VAT A
                                  Cashewkerne 200g            2,89, VAT A
                                Paprika rot, spitz            1,69, VAT A
                                          Zitranen            0,95, VAT A
                                          Broccoli            0,37, VAT A
                                    Blumenzwiebeln            2,99, VAT A
                              Eier aus Rheinl.-Pf.            1,09, VAT A
                             Schinkenwiirstch. Ser   2 x 1,09 2,18, VAT A
                                   Schlagsahne 30K            0,69, VAT A
--- 0.016 seconds ---
Comparison Scores
            Karstadt 0.269789
                Lidl 0.230820
                  dm 0.207934
   Karstadt Feinkost 0.185604
              TKMaxx 0.159013
           Aldi Sued 0.215085
              Oishii 0.245786
             Rossman 0.183388
     Galeria Kaufhof 0.173720
             Primark 0.809676
--- 15.458 seconds ---

--- Receipt ---
Store: Primark
Date:  11/05/17
Paid:  None

Items:
                          0584907 LIVING SUPERSOFT            , VAT 
                            0991711 VALUE XL TOWEL            , VAT 
--- 0.011 seconds ---
Comparison Scores
            Karstadt 0.175277
                Lidl 0.219194
                  dm 0.177990
   Karstadt Feinkost 0.138143
              TKMaxx 0.170320
           Aldi Sued 0.123253
              Oishii 0.201084
             Rossman 0.171562
     Galeria Kaufhof 0.154115
             Primark 0.131740
--- 13.118 seconds ---

--- Receipt ---
Store: <unknown>
Date:  23.05.17
Paid:  None

Items:
--- 0.007 seconds ---
Comparison Scores
            Karstadt 0.408098
                Lidl 0.822335
                  dm 0.402024
   Karstadt Feinkost 0.233628
              TKMaxx 0.303395
           Aldi Sued 0.245912
              Oishii 0.439542
             Rossman 0.296885
     Galeria Kaufhof 0.333855
             Primark 0.233110