{"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":"## Prebuilt AlexeyAB/darknet Binary and Python Module\n\nDue to permission constraint on Kaggle notebook container enviroment, it seems not possible to build darknet from source (`libcuda.so` is not accessible).\n\nAfter many attempts, I discovered that we can upload and use the prebuilt binary and python files directly as a Kaggle dataset, then everything works!\n\nHere is a quick demonstration to the [public dataset](https://www.kaggle.com/markpeng/darknetbuildgpu) of darknet files prebuilt from my Ubuntu 18.04 machine. We can now do both training and inference using the native darknet program (https://github.com/AlexeyAB/darknet).\n\nHope this dataset could be helpful to the others and ease the pain.\n\n\n**Note:**\nThe Dockerfile that I used to prebuilt darknet:\n - https://github.com/guitarmind/dockerfiles/blob/master/deepo/18.04/Dockerfile\n - https://hub.docker.com/repository/docker/guitarmind/deepo","metadata":{}},{"cell_type":"code","source":"!cp \"../input/darknetbuildgpu/darknet\" .\n!cp \"../input/darknetbuildgpu/libdarknet.so\" .\n!cp \"../input/darknetbuildgpu/darknet.py\" .","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-08-15T06:03:30.777047Z","iopub.execute_input":"2021-08-15T06:03:30.777413Z","iopub.status.idle":"2021-08-15T06:03:32.940571Z","shell.execute_reply.started":"2021-08-15T06:03:30.777381Z","shell.execute_reply":"2021-08-15T06:03:32.939647Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!ls -la","metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","execution":{"iopub.status.busy":"2021-08-15T06:03:36.406621Z","iopub.execute_input":"2021-08-15T06:03:36.407072Z","iopub.status.idle":"2021-08-15T06:03:37.039551Z","shell.execute_reply.started":"2021-08-15T06:03:36.407023Z","shell.execute_reply":"2021-08-15T06:03:37.038734Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!chmod a+x darknet","metadata":{"execution":{"iopub.status.busy":"2021-08-15T06:03:40.22261Z","iopub.execute_input":"2021-08-15T06:03:40.222982Z","iopub.status.idle":"2021-08-15T06:03:40.851739Z","shell.execute_reply.started":"2021-08-15T06:03:40.222943Z","shell.execute_reply":"2021-08-15T06:03:40.850603Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!./darknet detector train","metadata":{"execution":{"iopub.status.busy":"2021-08-15T06:03:42.995449Z","iopub.execute_input":"2021-08-15T06:03:42.995798Z","iopub.status.idle":"2021-08-15T06:03:43.971627Z","shell.execute_reply.started":"2021-08-15T06:03:42.995765Z","shell.execute_reply":"2021-08-15T06:03:43.970781Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import darknet as dn\ndn.detect","metadata":{"execution":{"iopub.status.busy":"2021-08-15T06:03:49.63638Z","iopub.execute_input":"2021-08-15T06:03:49.636725Z","iopub.status.idle":"2021-08-15T06:03:49.682272Z","shell.execute_reply.started":"2021-08-15T06:03:49.636692Z","shell.execute_reply":"2021-08-15T06:03:49.681568Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]}]}