{"cells":[{"metadata":{"_uuid":"dfa26de2c0a3e57e602d8ea83fe350a79e52b7d2"},"cell_type":"markdown","source":"# Intro\n\nYou don't directly choose the numbers to go into your convolutions for deep learning... instead the deep learning technique determines what convolutions will be useful from the data (as part of model-training). We'll come back to how the model does that soon.\n\n![Imgur](https://i.imgur.com/op9Maqr.png)\n\nBut looking closely at convolutions and how they are applied to your image will improve your intuition for these models, how they work, and how to debug them when they don't work.\n\n**Let's get started.**\n\n# Exercises\nWe'll use some small utilty functions to visualize raw images and some results of your code. Execute the next cell to load the utility functions."},{"metadata":{"collapsed":true,"trusted":false,"_uuid":"22c9e254e85d81d9cf45a9b7a18bbc9231116c53"},"cell_type":"code","source":"# Set up code checking\nfrom learntools.core import binder\nbinder.bind(globals())\nfrom learntools.deep_learning.exercise_1 import *\nprint(\"Setup Complete\")","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"2f7dd43422b405ea73a9464824bad566f7a05085"},"cell_type":"markdown","source":"### Exercise 1\n\nIn the video, you saw a convolution that detected horizontal lines. That convolution shows up again in the code cell below.\n\nRun the cell to see a raw image as well as the output from applying this convolution to the image.\n"},{"metadata":{"trusted":false,"_uuid":"dab59df103b380a0e296f18cbd426d73b554efa4"},"cell_type":"code","source":"horizontal_line_conv = [[1, 1], \n                        [-1, -1]]\n# load_my_image and visualize_conv are utility functions provided for this exercise\noriginal_image = load_my_image() \nvisualize_conv(original_image, horizontal_line_conv)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"7b3e56ad9cdc9ecdcd01be9fb7d0441850abffd9"},"cell_type":"markdown","source":"Now it's your turn. Instead of a horizontal line detector, you will create a vertical line detector.\n\n**Replace the underscores with numbers to make a vertical line detector and uncomment both lines of code in the cell below. Then run **"},{"metadata":{"collapsed":true,"trusted":false,"_uuid":"9e3bede740b2bc5802d2a9aea645ed47ac1e0180"},"cell_type":"code","source":"vertical_line_conv = [[-1, 1], \n                      [-1, 1]]\n\nq_1.check()\nvisualize_conv(original_image, vertical_line_conv)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"149058a1e14013344ca5bcc91e3f8689ae1c4dda"},"cell_type":"markdown","source":"If you'd like a hint or the solution, uncomment the appropriate line below."},{"metadata":{"trusted":false,"_uuid":"40b73f60a307a65f338e5f2a4398a742fed0b7a3"},"cell_type":"code","source":"#q_1.hint()\n#q_1.solution()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"9b7ab0904ccdb4c97ae9ee67e5fb758d1bf09a78"},"cell_type":"markdown","source":"### Exercise 2\nThe convolutions you've seen are 2x2.  But you could have larger convolutions. They could be 3x3, 4x4, etc.  They don't even have to be square. Nothing prevents using a 4x7 convolution.\n\nCompare the number of visual patterns that can be captured by small convolutions. Which of the following is true?\n\n- There are more visual patterns that can be captured by large convolutions\n- There are fewer visual patterns that can be captured by large convolutions\n- The number of visual patterns that can be captured by large convolutions is the same as the number of visual patterns that can be captured by small convolutions?\n\nOnce you think you know the answer, check it by uncommenting and running the line below."},{"metadata":{"trusted":false,"_uuid":"f172f3d82c571f3f4e535624dae565b650bce23d"},"cell_type":"code","source":"q_2.solution()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"8931720b0277735007ae1bb4da8b45cdf804e326"},"cell_type":"markdown","source":"# Keep Going\nNow you are ready to **[combine convolutions into powerful models](https://www.kaggle.com/dansbecker/building-models-from-convolutions).** These models are fun to work with, so keep going.\n\n---\n**[Deep Learning Course Home Page](https://www.kaggle.com/learn/deep-learning)**\n"}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}