{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-03-28T17:46:42.280832Z","iopub.execute_input":"2023-03-28T17:46:42.281252Z","iopub.status.idle":"2023-03-28T17:47:25.29328Z","shell.execute_reply.started":"2023-03-28T17:46:42.281214Z","shell.execute_reply":"2023-03-28T17:47:25.291858Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"<center><img src=\"https://storage.googleapis.com/kaggle-competitions/kaggle/43873/logos/header.png?t=2022-12-22-19-09-01\" width=\"900\"></center>\n\n# <center><b><span style='color:#FF9B9B'>Benetech | Simple OCR Network</span></b></center>\n\n\n### <b><span style='color:#FF9B9B'>Table of Contents</span></b><a class='anchor' id='top'>\n\nThe notebook will be divided into separate sections to provide an organized walk-through. The sections are:\n\n<div style=\" background-color:#3b3745; padding: 13px 13px; border-radius: 8px; color: white\">  \n<ol>\n    <li><a href=\"#import_libraries\">Import Libraries</a></li>\n    <li><a href=\"#load_image\">Load Image</a></li>\n    <li><a href=\"#load_annotation\">Load Annotation</a></li>\n    <li><a href=\"#plot_annotation\">Plot all annotation information from image</a></li>\n    <li><a href=\"#ocr\">Object Character Recognition</a></li>\n    <li><a href=\"#bbox\">Predict Bounding Boxes</a></li>\n</ol> \n</div> ","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:56:25.501591Z","iopub.execute_input":"2023-03-28T17:56:25.502026Z","iopub.status.idle":"2023-03-28T17:56:25.512526Z","shell.execute_reply.started":"2023-03-28T17:56:25.501984Z","shell.execute_reply":"2023-03-28T17:56:25.510822Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# <b>1 <span style='color:#FF9B9B'>|</span> Import Libraries</b><a class='anchor' id='import_libraries'></a> [↑](#top) \n***","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:48:09.608947Z","iopub.execute_input":"2023-03-28T17:48:09.609617Z","iopub.status.idle":"2023-03-28T17:48:09.616236Z","shell.execute_reply.started":"2023-03-28T17:48:09.609576Z","shell.execute_reply":"2023-03-28T17:48:09.614791Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%config Completer.use_jedi = False","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:10:05.457814Z","iopub.execute_input":"2023-03-28T17:10:05.45825Z","iopub.status.idle":"2023-03-28T17:10:05.467007Z","shell.execute_reply.started":"2023-03-28T17:10:05.45821Z","shell.execute_reply":"2023-03-28T17:10:05.465855Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install -Uqqq pycocotools","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:10:58.002247Z","iopub.execute_input":"2023-03-28T17:10:58.003697Z","iopub.status.idle":"2023-03-28T17:11:09.183874Z","shell.execute_reply.started":"2023-03-28T17:10:58.003634Z","shell.execute_reply":"2023-03-28T17:11:09.182313Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from IPython.display import Image\nImage(filename='/kaggle/input/benetech-making-graphs-accessible/train/images/0000ae6cbdb1.jpg') ","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:12:26.508083Z","iopub.execute_input":"2023-03-28T17:12:26.509511Z","iopub.status.idle":"2023-03-28T17:12:26.523891Z","shell.execute_reply.started":"2023-03-28T17:12:26.509429Z","shell.execute_reply":"2023-03-28T17:12:26.522945Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from IPython.display import Image\nImage(filename='/kaggle/input/benetech-making-graphs-accessible/train/images/183bc1684dc1.jpg') ","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:58:38.257864Z","iopub.execute_input":"2023-03-28T17:58:38.258697Z","iopub.status.idle":"2023-03-28T17:58:38.270606Z","shell.execute_reply.started":"2023-03-28T17:58:38.258644Z","shell.execute_reply":"2023-03-28T17:58:38.269215Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Image(filename='/kaggle/input/benetech-making-graphs-accessible/train/images/000631f33080.jpg') ","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:13:22.149241Z","iopub.execute_input":"2023-03-28T17:13:22.149924Z","iopub.status.idle":"2023-03-28T17:13:22.162946Z","shell.execute_reply.started":"2023-03-28T17:13:22.149882Z","shell.execute_reply":"2023-03-28T17:13:22.161504Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from IPython.display import Image\nImage(filename='/kaggle/input/benetech-making-graphs-accessible/train/images/8b119ce2ddc7.jpg') ","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:16:42.377915Z","iopub.execute_input":"2023-03-28T18:16:42.37876Z","iopub.status.idle":"2023-03-28T18:16:42.389359Z","shell.execute_reply.started":"2023-03-28T18:16:42.37871Z","shell.execute_reply":"2023-03-28T18:16:42.388308Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"graph_dir = '/kaggle/input/benetech-making-graphs-accessible/train/annotations'\nfilenames = os.listdir(graph_dir)\nprint(\"Number of articles retrieved from biorxiv:\", len(filenames))","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:14:36.272796Z","iopub.execute_input":"2023-03-28T17:14:36.273219Z","iopub.status.idle":"2023-03-28T17:14:36.305739Z","shell.execute_reply.started":"2023-03-28T17:14:36.27318Z","shell.execute_reply":"2023-03-28T17:14:36.304663Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"annotation = '/kaggle/input/benetech-making-graphs-accessible/train/annotations'\nannot_df = pd.DataFrame()\nfor root, dirs, files in os.walk(annotation):\n    for name in files:       \n        f = os.path.join(root, name)\n        with open(f) as f:\n            d = json.load(f)\n        tt = json_normalize(d, max_level = 1)\n        tt['file']= name.split('.')[0]\n        annot_df = pd.concat([annot_df, tt], axis=0)  ","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:15:54.630927Z","iopub.execute_input":"2023-03-28T17:15:54.631348Z","iopub.status.idle":"2023-03-28T17:32:57.20111Z","shell.execute_reply.started":"2023-03-28T17:15:54.631309Z","shell.execute_reply":"2023-03-28T17:32:57.199975Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.set_option('display.max_columns', None)  ","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:33:29.385525Z","iopub.execute_input":"2023-03-28T17:33:29.385936Z","iopub.status.idle":"2023-03-28T17:33:29.391294Z","shell.execute_reply.started":"2023-03-28T17:33:29.385901Z","shell.execute_reply":"2023-03-28T17:33:29.390112Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"annot_df.head(5)","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:33:42.958837Z","iopub.execute_input":"2023-03-28T17:33:42.959268Z","iopub.status.idle":"2023-03-28T17:33:43.125614Z","shell.execute_reply.started":"2023-03-28T17:33:42.959232Z","shell.execute_reply":"2023-03-28T17:33:43.124248Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"JSON_COLUMNS = ['data-series']\nfor column in JSON_COLUMNS:\n    column_as_df = json_normalize(annot_df[column])\n    column_as_df.columns = [f\"{column}.{subcolumn}\" for subcolumn in column_as_df.columns]\n    df = annot_df.drop(column, axis=1).merge(column_as_df, right_index=True, left_index=True)","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:35:33.77187Z","iopub.execute_input":"2023-03-28T17:35:33.772278Z","iopub.status.idle":"2023-03-28T17:35:38.191082Z","shell.execute_reply.started":"2023-03-28T17:35:33.772243Z","shell.execute_reply":"2023-03-28T17:35:38.189959Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:36:04.547542Z","iopub.execute_input":"2023-03-28T17:36:04.548638Z","iopub.status.idle":"2023-03-28T17:36:04.792327Z","shell.execute_reply.started":"2023-03-28T17:36:04.548591Z","shell.execute_reply":"2023-03-28T17:36:04.791429Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('../input/benetech-making-graphs-accessible/sample_submission.csv')\ndf.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:49:42.591464Z","iopub.execute_input":"2023-03-28T17:49:42.591878Z","iopub.status.idle":"2023-03-28T17:49:42.610334Z","shell.execute_reply.started":"2023-03-28T17:49:42.591841Z","shell.execute_reply":"2023-03-28T17:49:42.609034Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"## Based on: https://www.kaggle.com/eigrad/convert-rle-to-bounding-box-x0-y0-x1-y1\ndef rle2mask(rle, img_w, img_h):\n    \n    ## transforming the string into an array of shape (2, N)\n    array = np.fromiter(rle.split(), dtype = np.uint)\n    array = array.reshape((-1,2)).T\n    array[0] = array[0] - 1\n    \n    ## decompressing the rle encoding (ie, turning [3, 1, 10, 2] into [3, 4, 10, 11, 12])\n    # for faster mask construction\n    starts, lenghts = array\n    mask_decompressed = np.concatenate([np.arange(s, s + l, dtype = np.uint) for s, l in zip(starts, lenghts)])\n\n    ## Building the binary mask\n    msk_img = np.zeros(img_w * img_h, dtype = np.uint8)\n    msk_img[mask_decompressed] = 1\n    msk_img = msk_img.reshape((img_h, img_w))\n    msk_img = np.asfortranarray(msk_img) ## This is important so pycocotools can handle this object\n    \n    return msk_img","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:51:52.79121Z","iopub.execute_input":"2023-03-28T17:51:52.792196Z","iopub.status.idle":"2023-03-28T17:51:52.805024Z","shell.execute_reply.started":"2023-03-28T17:51:52.792149Z","shell.execute_reply":"2023-03-28T17:51:52.803722Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Jensen https://www.kaggle.com/code/a03102030/simple-cnn-for-top-10000-data\n#https://www.kaggle.com/code/mpwolke/iwildcam-2022-cnn\n\nimg=[]\nfilename=df.name[:10000]#original is id\nlabel=df.source[:10000]\nfor file in filename:\n    image=cv2.imread(\"../input/benetech-making-graphs-accessible/train/images/\"+file+'.jpg')\n    res=cv2.resize(image,(32,32))\n    img.append(res)\nimg=np.array(img)","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:52:02.17718Z","iopub.execute_input":"2023-03-28T17:52:02.178128Z","iopub.status.idle":"2023-03-28T17:52:02.2796Z","shell.execute_reply.started":"2023-03-28T17:52:02.178083Z","shell.execute_reply":"2023-03-28T17:52:02.277825Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Loading SeshuRajuP data","metadata":{}},{"cell_type":"code","source":"import json \nimport os\nimport pandas as pd \nfrom pandas.io.json import json_normalize #package for flattening json in pandas df","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:11:14.83129Z","iopub.execute_input":"2023-03-28T17:11:14.831735Z","iopub.status.idle":"2023-03-28T17:11:14.837207Z","shell.execute_reply.started":"2023-03-28T17:11:14.831689Z","shell.execute_reply":"2023-03-28T17:11:14.836084Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('../input/benetech-making-graphs-accessible-csv/train.csv')\ndf.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-28T17:11:32.427078Z","iopub.execute_input":"2023-03-28T17:11:32.427525Z","iopub.status.idle":"2023-03-28T17:11:32.46124Z","shell.execute_reply.started":"2023-03-28T17:11:32.427482Z","shell.execute_reply":"2023-03-28T17:11:32.459358Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import requests\nfrom bs4 import BeautifulSoup\nimport lxml\nimport urllib\nimport sys\nfrom PIL import Image\nimport cv2\nimport csv\nimport multiprocessing\nimport matplotlib.pyplot as plt\nimport math\nimport time\nimport datetime\nimport glob","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:18:52.302468Z","iopub.execute_input":"2023-03-28T18:18:52.302895Z","iopub.status.idle":"2023-03-28T18:18:52.487143Z","shell.execute_reply.started":"2023-03-28T18:18:52.302857Z","shell.execute_reply":"2023-03-28T18:18:52.485954Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Code by Ventakumar R https://www.kaggle.com/venkatkumar001/hfp-2-eda-tensorflow/notebook\n\nimport json, codecs\n\nwith codecs.open(\"../input/benetech-making-graphs-accessible/train/annotations/002bcf154c3d.json\", 'r',\n                 encoding='utf-8', errors='ignore') as f:\n    train_meta = json.load(f)\n    \n#with codecs.open(\"../input/.json\", 'r',\n #                encoding='utf-8', errors='ignore') as f:\n  #  test_meta = json.load(f)","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:19:07.123631Z","iopub.execute_input":"2023-03-28T18:19:07.124577Z","iopub.status.idle":"2023-03-28T18:19:07.131219Z","shell.execute_reply.started":"2023-03-28T18:19:07.124534Z","shell.execute_reply":"2023-03-28T18:19:07.129803Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import cv2 as cv\n\nimg = cv.imread('../input/benetech-making-graphs-accessible/train/images/002b6b51c9f1.jpg')\nprint( img.shape )","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:19:27.938313Z","iopub.execute_input":"2023-03-28T18:19:27.938741Z","iopub.status.idle":"2023-03-28T18:19:27.96857Z","shell.execute_reply.started":"2023-03-28T18:19:27.938704Z","shell.execute_reply":"2023-03-28T18:19:27.967273Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"DATA_PATH = \"../input/benetech-making-graphs-accessible/\"","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:19:43.905962Z","iopub.execute_input":"2023-03-28T18:19:43.907227Z","iopub.status.idle":"2023-03-28T18:19:43.912363Z","shell.execute_reply.started":"2023-03-28T18:19:43.90718Z","shell.execute_reply":"2023-03-28T18:19:43.911076Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image_paths = sorted(glob.glob(os.path.join(DATA_PATH, 'train/images/*.jpg')))","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:19:58.567713Z","iopub.execute_input":"2023-03-28T18:19:58.568138Z","iopub.status.idle":"2023-03-28T18:19:58.788198Z","shell.execute_reply.started":"2023-03-28T18:19:58.568089Z","shell.execute_reply":"2023-03-28T18:19:58.786967Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"Number of images: {len(image_paths)}\")","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:20:10.934111Z","iopub.execute_input":"2023-03-28T18:20:10.93453Z","iopub.status.idle":"2023-03-28T18:20:10.940745Z","shell.execute_reply.started":"2023-03-28T18:20:10.934492Z","shell.execute_reply":"2023-03-28T18:20:10.939189Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"paths = sorted(glob.glob(\"../input/benetech-making-graphs-accessible/train/images/*\"))","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:20:36.133915Z","iopub.execute_input":"2023-03-28T18:20:36.13467Z","iopub.status.idle":"2023-03-28T18:20:36.352272Z","shell.execute_reply.started":"2023-03-28T18:20:36.134629Z","shell.execute_reply":"2023-03-28T18:20:36.351332Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf \nimport numpy as np\nimport os\nimport matplotlib.pyplot as plt \ntf.__version__","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:20:47.294701Z","iopub.execute_input":"2023-03-28T18:20:47.295745Z","iopub.status.idle":"2023-03-28T18:20:56.218628Z","shell.execute_reply.started":"2023-03-28T18:20:47.295697Z","shell.execute_reply":"2023-03-28T18:20:56.217124Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Name0=os.listdir('../input/benetech-making-graphs-accessible')\nName=sorted(Name0)\nn=len(Name)\nN=list(range(n))\nnormal_mapping=dict(zip(Name,N)) \nreverse_mapping=dict(zip(N,Name)) ","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:21:05.416539Z","iopub.execute_input":"2023-03-28T18:21:05.417824Z","iopub.status.idle":"2023-03-28T18:21:05.424765Z","shell.execute_reply.started":"2023-03-28T18:21:05.417769Z","shell.execute_reply":"2023-03-28T18:21:05.423469Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator\n\nimg_generator = tf.keras.preprocessing.image.ImageDataGenerator(\n                            #rotation_range=90,\n                            brightness_range=(0.5,1), \n                            #shear_range=0.2, \n                            #zoom_range=0.2,\n                            channel_shift_range=0.2,\n                            horizontal_flip=False,\n                            vertical_flip=False,\n                            rescale=1./255,\n                            validation_split=0.3)","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:21:23.134519Z","iopub.execute_input":"2023-03-28T18:21:23.135357Z","iopub.status.idle":"2023-03-28T18:21:23.142255Z","shell.execute_reply.started":"2023-03-28T18:21:23.135312Z","shell.execute_reply":"2023-03-28T18:21:23.140764Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Stpete Ishii https://www.kaggle.com/code/stpeteishii/transfer-learning-for-manga-facial-expressions\n\nroot_dir = '../input/benetech-making-graphs-accessible'\n\nimg_generator_flow_train = img_generator.flow_from_directory(\n    directory=root_dir,\n    target_size=(224, 224),\n    batch_size=32,\n    shuffle=True,\n    subset=\"training\")\n\nimg_generator_flow_valid = img_generator.flow_from_directory(\n    directory=root_dir,\n    target_size=(224, 224),\n    batch_size=32,\n    shuffle=True,\n    subset=\"validation\")","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:21:41.902559Z","iopub.execute_input":"2023-03-28T18:21:41.902962Z","iopub.status.idle":"2023-03-28T18:22:23.327443Z","shell.execute_reply.started":"2023-03-28T18:21:41.902927Z","shell.execute_reply":"2023-03-28T18:22:23.326323Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Stpete Ishii https://www.kaggle.com/code/stpeteishii/transfer-learning-for-manga-facial-expressions\n\nimgs, labels = next(iter(img_generator_flow_train))\nfor img, label in zip(imgs, labels):\n    value=np.argmax(label)\n    plt.imshow(img)\n    plt.title(reverse_mapping[value])\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:22:41.256797Z","iopub.execute_input":"2023-03-28T18:22:41.257641Z","iopub.status.idle":"2023-03-28T18:22:47.780894Z","shell.execute_reply.started":"2023-03-28T18:22:41.257593Z","shell.execute_reply":"2023-03-28T18:22:47.780029Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Ihelon https://www.kaggle.com/code/ihelon/lego-minifigure-faces-overview\n\nn_cols = 4\nn_rows = int(math.ceil(len(paths) / n_cols))\n\nfor r in range(n_rows):\n    plt.figure(figsize=(16, 5))\n    for c in range(n_cols):\n        plt.subplot(1, n_cols, c + 1)\n        current = r * n_cols + c\n        if current >= len(paths):\n            break\n        image = cv2.imread(paths[current])\n        image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\n        plt.imshow(image)\n        plt.xticks([])\n        plt.yticks([])\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-28T18:23:37.948574Z","iopub.execute_input":"2023-03-28T18:23:37.949347Z"},"trusted":true},"execution_count":null,"outputs":[]}]}