{"cells":[{"metadata":{},"cell_type":"markdown","source":"# 配置环境","execution_count":null},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"!conda create -n open-mmlab python=3.7 -y\n!source activate open-mmlab","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!conda install pytorch torchvision -c pytorch","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!git clone https://github.com/open-mmlab/mmcv.git\n!cd mmcv\n!pip install . \n!cd ..","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!pip install pycocotools ","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!git clone https://github.com/open-mmlab/mmdetection.git","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"cd mmdetection/","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!pip install -r requirements.txt","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!pip install opencv-python","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# 替换coco.py文件","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"rm -rf /kaggle/working/mmdetection/mmdet/datasets/coco.py","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"cp -r /kaggle/input/mmdetection/coco.py /kaggle/working/mmdetection/mmdet/datasets/coco.py","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# 替换class_name文件","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"rm -rf /kaggle/working/mmdetection/mmdet/core/evaluation/class_names.py","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"cp -r /kaggle/input/mmdetection/class_names.py /kaggle/working/mmdetection/mmdet/core/evaluation/class_names.py","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"rm -rf /kaggle/working/mmdetection/global-wheat-detection/datasets/coco_detection.py","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"cp -r /kaggle/input/mmdetection/global-wheat-detection /kaggle/working/mmdetection/","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!python setup.py develop","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!python /kaggle/input/yuchuli1/kaggle_csv.py","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!rm -rf work_dirs\n!mkdir work_dirs","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# 训练代码","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"!python /kaggle/working/mmdetection/tools/train.py /kaggle/working/mmdetection/global-wheat-detection/cascade_rcnn_r50_fpn_1x_coco.py  --work-dir /kaggle/working/mmdetection/work_dirs","execution_count":null,"outputs":[]}],"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}