{"cells":[{"metadata":{},"cell_type":"markdown","source":"<p style=\"font-size:20px\">Okay, here's a challenge: \n    \n<h2 style=\"font-size:27px\">Image Classifier but you have 10 Lines of Code to spare 😈.</h2>\n\n<p style=\"font-size:20px\">Mark Zuckerberg once famously said:<br><br>\"That's a lot of lines of Code. 😥\"<br>\n(When he saw a piece of code that had 10,000 lines in it.)<br><br>\nI hope you liked this anecdote. My point being, I just want to show you how easy it is to create an Image Classifier!</p>"},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"!pip install -Uq fastai","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"<h1 style=\"font-size:30px\">If you liked my work or choose to fork/refer to it: do tag me in! An upvote would help as well. 🤠</h1>"},{"metadata":{"trusted":true},"cell_type":"code","source":"import pandas as pd\nfrom fastai.vision.all import *\n\ndf = pd.read_csv(\"../input/ranzcr-clip-catheter-line-classification/train_annotations.csv\")[['StudyInstanceUID', 'label']]\ndf['StudyInstanceUID'] = [i + \".jpg\" for i in df['StudyInstanceUID']]\ndf.columns = ['name', 'label']","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"dls = ImageDataLoaders.from_df(df, \"../input/ranzcr-clip-catheter-line-classification/\", folder='train', valid_pct=0.2, item_tfms=Resize(224))\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"dls.show_batch()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"learn = cnn_learner(dls, resnet34, metrics=error_rate)\nlearn.fine_tune(1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"learn.predict(\"../input/ranzcr-clip-catheter-line-classification/train/1.2.826.0.1.3680043.8.498.10000428974990117276582711948006105617.jpg\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"<p style=\"font-size:30px\">⁣          🎈🎈  ☁️<br>\n         🎈🎈🎈<br>\n ☁️     🎈🎈🎈🎈<br>\n        🎈🎈🎈🎈<br>\n   ☁️    ⁣🎈🎈🎈<br>\n           \\|/<br>\n           🏠   ☁️<br>\n   ☁️         ☁️<br>\n<br>\n🌳🌹🏫🌳🏢🏢_🏢🏢🌳🌳<br></p>"}],"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":4,"nbformat_minor":4}