{"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":"! conda install -y gdown","metadata":{"execution":{"iopub.status.busy":"2022-12-26T14:56:38.506788Z","iopub.execute_input":"2022-12-26T14:56:38.507251Z","iopub.status.idle":"2022-12-26T14:57:46.917754Z","shell.execute_reply.started":"2022-12-26T14:56:38.507172Z","shell.execute_reply":"2022-12-26T14:57:46.916622Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%cd /kaggle/working","metadata":{"execution":{"iopub.status.busy":"2022-12-26T14:57:46.920283Z","iopub.execute_input":"2022-12-26T14:57:46.920685Z","iopub.status.idle":"2022-12-26T14:57:46.931471Z","shell.execute_reply.started":"2022-12-26T14:57:46.920642Z","shell.execute_reply":"2022-12-26T14:57:46.930297Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!git clone https://github.com/AlexeyAB/darknet.git","metadata":{"execution":{"iopub.status.busy":"2022-12-26T14:57:46.932850Z","iopub.execute_input":"2022-12-26T14:57:46.933321Z","iopub.status.idle":"2022-12-26T14:57:50.590117Z","shell.execute_reply.started":"2022-12-26T14:57:46.933272Z","shell.execute_reply":"2022-12-26T14:57:50.588978Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%cd darknet","metadata":{"execution":{"iopub.status.busy":"2022-12-26T14:57:50.594609Z","iopub.execute_input":"2022-12-26T14:57:50.594936Z","iopub.status.idle":"2022-12-26T14:57:50.602553Z","shell.execute_reply.started":"2022-12-26T14:57:50.594903Z","shell.execute_reply":"2022-12-26T14:57:50.601438Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"install opencv","metadata":{}},{"cell_type":"code","source":"#OpenCV configuration\n!apt update\n!apt install --yes python-opencv\n!apt install --yes libopencv-dev\n!/bin/bash -c 'echo \"/opt/conda/lib/\" > /etc/ld.so.conf.d/opencv.conf'\n!ldconfig","metadata":{"execution":{"iopub.status.busy":"2022-12-26T14:57:50.604239Z","iopub.execute_input":"2022-12-26T14:57:50.605468Z","iopub.status.idle":"2022-12-26T14:58:55.437044Z","shell.execute_reply.started":"2022-12-26T14:57:50.605429Z","shell.execute_reply":"2022-12-26T14:58:55.435318Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!apt list --upgradable","metadata":{"execution":{"iopub.status.busy":"2022-12-26T14:58:55.439140Z","iopub.execute_input":"2022-12-26T14:58:55.439570Z","iopub.status.idle":"2022-12-26T14:58:58.372607Z","shell.execute_reply.started":"2022-12-26T14:58:55.439525Z","shell.execute_reply":"2022-12-26T14:58:58.371404Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!cp '../../input/libcuda/libcuda.so' .","metadata":{"execution":{"iopub.status.busy":"2022-12-26T14:58:58.374688Z","iopub.execute_input":"2022-12-26T14:58:58.375149Z","iopub.status.idle":"2022-12-26T14:58:59.513795Z","shell.execute_reply.started":"2022-12-26T14:58:58.375095Z","shell.execute_reply":"2022-12-26T14:58:59.512396Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!sed -i 's/OPENCV=0/OPENCV=1/g' Makefile\n!sed -i 's/GPU=0/GPU=1/g' Makefile\n!sed -i 's/CUDNN=0/CUDNN=1/g' Makefile\n!sed -i 's/CUDNN_HALF=0/CUDNN_HALF=1/g' Makefile\n!sed -i 's/LIBSO=0/LIBSO=1/' Makefile\n!sed -i \"s/ARCH= -gencode arch=compute_60,code=sm_60/ARCH= ${ARCH_VALUE}/g\" Makefile","metadata":{"execution":{"iopub.status.busy":"2022-12-26T14:58:59.516041Z","iopub.execute_input":"2022-12-26T14:58:59.516469Z","iopub.status.idle":"2022-12-26T14:59:05.268228Z","shell.execute_reply.started":"2022-12-26T14:58:59.516424Z","shell.execute_reply":"2022-12-26T14:59:05.266914Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Modify Makefile by adding your local path towards libcuda.so and compile","metadata":{}},{"cell_type":"code","source":"!sed -i 's/LDFLAGS+= -L\\/usr\\/local\\/cuda\\/lib64 -lcuda -lcudart -lcublas -lcurand/LDFLAGS+= -L\\/usr\\/local\\/cuda\\/lib64 -lcudart -lcublas -lcurand -L\\/kaggle\\/working\\/darknet -lcuda/' Makefile","metadata":{"execution":{"iopub.status.busy":"2022-12-26T14:59:05.270888Z","iopub.execute_input":"2022-12-26T14:59:05.271656Z","iopub.status.idle":"2022-12-26T14:59:06.215691Z","shell.execute_reply.started":"2022-12-26T14:59:05.271611Z","shell.execute_reply":"2022-12-26T14:59:06.214404Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!make &> compile.log","metadata":{"execution":{"iopub.status.busy":"2022-12-26T14:59:06.219941Z","iopub.execute_input":"2022-12-26T14:59:06.220838Z","iopub.status.idle":"2022-12-26T14:59:07.582245Z","shell.execute_reply.started":"2022-12-26T14:59:06.220793Z","shell.execute_reply":"2022-12-26T14:59:07.580984Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Check there are no errors during compilation","metadata":{}},{"cell_type":"code","source":"!tail compile.log","metadata":{"execution":{"iopub.status.busy":"2022-12-26T14:59:07.584557Z","iopub.execute_input":"2022-12-26T14:59:07.584950Z","iopub.status.idle":"2022-12-26T14:59:08.673193Z","shell.execute_reply.started":"2022-12-26T14:59:07.584908Z","shell.execute_reply":"2022-12-26T14:59:08.672064Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}