{"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":"markdown","source":"**I am new to Machine Learning. Trying to understand the problem statement**","metadata":{}},{"cell_type":"code","source":"#Reading the image array\nimport cv2\npath ='/kaggle/input/tensorflow-great-barrier-reef/train_images/video_1/6234.jpg'\nimg = cv2.imread(path)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#How do I convert a numpy array to (and display) an image:\nfrom matplotlib import pyplot as plt\nplt.imshow(img, interpolation='nearest')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-01-28T20:28:26.165161Z","iopub.execute_input":"2022-01-28T20:28:26.166651Z","iopub.status.idle":"2022-01-28T20:28:26.61854Z","shell.execute_reply.started":"2022-01-28T20:28:26.166604Z","shell.execute_reply":"2022-01-28T20:28:26.617873Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Reading the train.csv file\nimport pandas as pd\ntrain_df = pd.read_csv('/kaggle/input/tensorflow-great-barrier-reef/train.csv')","metadata":{"execution":{"iopub.status.busy":"2022-01-28T20:28:26.619476Z","iopub.execute_input":"2022-01-28T20:28:26.619703Z","iopub.status.idle":"2022-01-28T20:28:26.65977Z","shell.execute_reply.started":"2022-01-28T20:28:26.619658Z","shell.execute_reply":"2022-01-28T20:28:26.659105Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Quick view of my train_df dataframe\nprint(train_df.tail())\ntrain_df.dtypes","metadata":{"execution":{"iopub.status.busy":"2022-01-28T20:28:26.661543Z","iopub.execute_input":"2022-01-28T20:28:26.661909Z","iopub.status.idle":"2022-01-28T20:28:26.673887Z","shell.execute_reply.started":"2022-01-28T20:28:26.66188Z","shell.execute_reply":"2022-01-28T20:28:26.672965Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Filtering the information of our desired image\ntrain_df.loc[( train_df['video_frame'] == 6234) & (train_df['video_id'] == 1)]","metadata":{"execution":{"iopub.status.busy":"2022-01-28T20:28:26.674929Z","iopub.execute_input":"2022-01-28T20:28:26.675233Z","iopub.status.idle":"2022-01-28T20:28:26.692872Z","shell.execute_reply.started":"2022-01-28T20:28:26.675202Z","shell.execute_reply":"2022-01-28T20:28:26.691203Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Drawing the boundary box on the image as per the given annotations\nimport matplotlib.patches as patches\n\n# Create figure and axes\nfig, ax = plt.subplots()\n\n# Display the image\nax.imshow(img)\n\n# Create a Rectangle patch\nrect = patches.Rectangle((566, 33), 57, 57, linewidth=1, edgecolor='r', facecolor='none')\n\n# Add the patch to the Axes\nax.add_patch(rect)\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-01-28T20:38:44.796246Z","iopub.execute_input":"2022-01-28T20:38:44.797199Z","iopub.status.idle":"2022-01-28T20:38:45.124311Z","shell.execute_reply.started":"2022-01-28T20:38:44.797156Z","shell.execute_reply":"2022-01-28T20:38:45.123363Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**To be Contd.....**","metadata":{}}]}