# Implementing Deep Convolutional Neural Networks for QR Code-Based Printed Source Identification
## 3 Proposed Method
### QR Code Extraction  
Through MATLAB, batch-like image extraction is designed specifically for black and white images to cut out all 24 QR code images on the same page by detecting the bounding box individually. There is a rough dimension of 554 \(\times\) 554 for all the QR codes, although some of them could be bigger or smaller by 1 to 5 pixels based on the printer. Saving all QR code images in the TIF format means that the scanned files are uncompressed images to ensure the intrinsic signatures, such as banding produced by the toner, are still in high resolution.  
In this step, all the extracted QR codes are divided into 4 \(\times\) 4-size blocks, as shown in Figures 6 and 7. Consequently, each printer has 240 QR code images, so splitting every image individually into 16 blocks means a total of 240 \(\times\) 16 = 3840 blocks. Since eleven printers are used for the test, as shown in Table 2, the overall accumulated images become 3840 \(\times\) 11 = 42,240 blocks.  
The QR code images are divided into 4 \(\times\) 4 blocks, which means 554/4 = \(\pm\)139 pixels. Since the size of each block of images may be slightly different, they need to be upscaled to a unified dimension. imageDataAugmenter, one of MATLAB's features is then adapted to upscale and unify all the images to 227 \(\times\) 227 (AlexNet), 224 \(\times\) 224 (the rest of the pretrained models), and 160 \(\times\) 160 (customized model) so that the image blocks can be implemented as input training images. Refer to Figures 6 and 7 for image block illustrations.  
In MATLAB, the training and testing/validation sets are divided based on the ratio 80:20 and treated as such. Both of them are combined in every epoch before being averaged into a single identification result.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**No** & **Brand** & **Model** \\ \hline
1 & Canon & ImageRunner 655 ei \\ \hline
2 & Canon & LBP9200C \\ \hline
3 & Fuji Xerox & ApeosPort-VII \\ \hline
4 & Fuji Xerox & DocuCentre-IV \\ \hline
5 & HP & M283 \\ \hline
6 & HP & M377 \\ \hline
7 & Konica Minolta & Magicolor 1690 \\ \hline
8 & Kyocera & Ecosys M5520 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Printer Brand and Model List (Color QR Code).  
An image datastore is a device that allows users to store large volumes of image data, even if data are not fitting in memory, and to read batches of images efficiently when processing network training.  
Based on the 80:20 ratio, the BW QR Code has a training set of 33,792 images and a test set of 8448 ones. The color QR Code has a training set of 24,576 images and a test set of 6144. The training and test sets are completely separate and use the splitEachLabel function as declared at the beginning of the data preprocessing right after the new images are loaded as an image datastore and waiting to be fed into the network. In MATLAB, the imageDatasore function automatically labels the images based on folder names and stores the data as ImageDatasore objects.  
Figure 6: Image samples for BW QR codes printed by 11 printers (please note that each number refers an item in Table 1 for the printer and brand model).