Delete plasticdetecv1.ipynb
Browse files- plasticdetecv1.ipynb +0 -1
plasticdetecv1.ipynb
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":9854673,"sourceType":"datasetVersion","datasetId":6047386}],"dockerImageVersionId":30786,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"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)\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":"52bf6a16-63ba-44ec-81c3-32fc03ab3043","_cell_guid":"f7b881ea-709e-4dad-ba03-f1803c7044d9","trusted":true,"collapsed":false,"execution":{"iopub.status.busy":"2024-11-09T16:59:01.344135Z","iopub.execute_input":"2024-11-09T16:59:01.344572Z","iopub.status.idle":"2024-11-09T16:59:01.738056Z","shell.execute_reply.started":"2024-11-09T16:59:01.344530Z","shell.execute_reply":"2024-11-09T16:59:01.737044Z"},"_kg_hide-output":false,"jupyter":{"outputs_hidden":false}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip install -Uqq fastai\nfrom fastai.vision.all import *\nfrom fastai.vision.widgets import *","metadata":{"_uuid":"01e5f562-3c57-41e4-b671-8c431c988ac9","_cell_guid":"140ca519-c26a-43e4-9292-2f4ce2100643","trusted":true,"collapsed":false,"execution":{"iopub.status.busy":"2024-11-09T16:59:01.740300Z","iopub.execute_input":"2024-11-09T16:59:01.741102Z","iopub.status.idle":"2024-11-09T16:59:14.024058Z","shell.execute_reply.started":"2024-11-09T16:59:01.741054Z","shell.execute_reply":"2024-11-09T16:59:14.022691Z"},"jupyter":{"outputs_hidden":false}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"path = '/kaggle/input/recyclability/data'\n\ndls = ImageDataLoaders.from_folder(\n path, \n valid_pct = 0.2, \n seed = 52, \n item_tfms = Resize(150))","metadata":{"_uuid":"ecc10dbb-87e0-4777-9c60-906ec6db1f26","_cell_guid":"a3d0cef0-a2a4-4fa0-a1ae-e7ce72607654","trusted":true,"collapsed":false,"execution":{"iopub.status.busy":"2024-11-09T16:59:14.025912Z","iopub.execute_input":"2024-11-09T16:59:14.026345Z","iopub.status.idle":"2024-11-09T16:59:14.369812Z","shell.execute_reply.started":"2024-11-09T16:59:14.026298Z","shell.execute_reply":"2024-11-09T16:59:14.368866Z"},"jupyter":{"outputs_hidden":false}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"learn = vision_learner(dls, resnet18, metrics=error_rate)\nlearn.fine_tune(3)","metadata":{"_uuid":"05af9fdc-0eb4-40aa-bcc7-cc5033f93a97","_cell_guid":"e031c0f8-1d29-4d33-8416-3fa9cf335094","trusted":true,"collapsed":false,"execution":{"iopub.status.busy":"2024-11-09T16:59:14.372699Z","iopub.execute_input":"2024-11-09T16:59:14.373149Z","iopub.status.idle":"2024-11-09T16:59:56.787664Z","shell.execute_reply.started":"2024-11-09T16:59:14.373097Z","shell.execute_reply":"2024-11-09T16:59:56.786454Z"},"jupyter":{"outputs_hidden":false}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"see_it = ClassificationInterpretation.from_learner(learn)\nsee_it.plot_confusion_matrix()","metadata":{"_uuid":"1b6ef87c-cedb-45f7-be4b-2cbbb9785f0a","_cell_guid":"baef77a0-43b5-4bc4-9dae-101e5b737dfb","trusted":true,"collapsed":false,"execution":{"iopub.status.busy":"2024-11-09T16:59:56.790909Z","iopub.execute_input":"2024-11-09T16:59:56.791250Z","iopub.status.idle":"2024-11-09T17:00:01.210951Z","shell.execute_reply.started":"2024-11-09T16:59:56.791214Z","shell.execute_reply":"2024-11-09T17:00:01.209865Z"},"jupyter":{"outputs_hidden":false}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"see_it.plot_top_losses(1, nrows=1, figsize=(17,4))","metadata":{"_uuid":"281a8322-180f-4fb3-bab1-5704fc2fab3e","_cell_guid":"8cdd1c8d-568b-4b1a-9864-6ac2a759dd6d","trusted":true,"collapsed":false,"execution":{"iopub.status.busy":"2024-11-09T17:00:01.215620Z","iopub.execute_input":"2024-11-09T17:00:01.218164Z","iopub.status.idle":"2024-11-09T17:00:01.685737Z","shell.execute_reply.started":"2024-11-09T17:00:01.218115Z","shell.execute_reply":"2024-11-09T17:00:01.684701Z"},"jupyter":{"outputs_hidden":false}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"cleaner = ImageClassifierCleaner(learn)","metadata":{"_uuid":"6c2e485a-9cf3-48ca-92f4-05e28c9feb27","_cell_guid":"c06ab310-7242-4e52-8169-8174e084fba8","trusted":true,"collapsed":false,"execution":{"iopub.status.busy":"2024-11-09T17:00:01.687157Z","iopub.execute_input":"2024-11-09T17:00:01.687505Z","iopub.status.idle":"2024-11-09T17:00:12.789399Z","shell.execute_reply.started":"2024-11-09T17:00:01.687462Z","shell.execute_reply":"2024-11-09T17:00:12.788170Z"},"jupyter":{"outputs_hidden":false}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"for idx in cleaner.delete(): cleaner.fns[inx].unlink()\nfor idx, cat in cleaner.change(): shutil.move(str(cleaner.fns[idx]), path/cat)","metadata":{"_uuid":"17290ca1-eeae-42ac-8ef6-17b9d1ec53c2","_cell_guid":"762a7e77-2889-4426-bf77-02a68d9989f3","trusted":true,"collapsed":false,"execution":{"iopub.status.busy":"2024-11-09T17:00:12.790987Z","iopub.execute_input":"2024-11-09T17:00:12.791297Z","iopub.status.idle":"2024-11-09T17:00:12.797888Z","shell.execute_reply.started":"2024-11-09T17:00:12.791263Z","shell.execute_reply":"2024-11-09T17:00:12.796953Z"},"jupyter":{"outputs_hidden":false}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"learn.export('/kaggle/working/model.pkl')","metadata":{"_uuid":"5b815ff5-36cf-45ba-8bb7-a427f25ab5af","_cell_guid":"bcad8606-957d-4d14-a558-89344d2412f8","trusted":true,"collapsed":false,"execution":{"iopub.status.busy":"2024-11-09T17:13:32.583329Z","iopub.execute_input":"2024-11-09T17:13:32.584409Z","iopub.status.idle":"2024-11-09T17:13:33.760539Z","shell.execute_reply.started":"2024-11-09T17:13:32.584349Z","shell.execute_reply":"2024-11-09T17:13:33.759074Z"},"jupyter":{"outputs_hidden":false}},"outputs":[],"execution_count":null}]}
|
|
|
|