{"id":23102664,"url":"https://github.com/dataxujing/cornernet-lite-pytorch","last_synced_at":"2025-08-05T23:35:07.368Z","repository":{"id":112305003,"uuid":"225194523","full_name":"DataXujing/CornerNet-Lite-Pytorch","owner":"DataXujing","description":":rotating_light::rotating_light::rotating_light: CornerNet:基于虚拟仿真环境下的自动驾驶交通标志识别","archived":false,"fork":false,"pushed_at":"2019-12-24T03:42:10.000Z","size":12121,"stargazers_count":38,"open_issues_count":3,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-07-31T21:53:48.530Z","etag":null,"topics":["anchor-free","cornernet","cornernet-lite","cv","detection","python3","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataXujing.png","metadata":{"files":{"readme":"README-CornerNet-lite.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-01T16:43:48.000Z","updated_at":"2024-05-13T12:02:28.000Z","dependencies_parsed_at":"2023-05-12T15:45:15.881Z","dependency_job_id":null,"html_url":"https://github.com/DataXujing/CornerNet-Lite-Pytorch","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataXujing%2FCornerNet-Lite-Pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataXujing%2FCornerNet-Lite-Pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataXujing%2FCornerNet-Lite-Pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataXujing%2FCornerNet-Lite-Pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataXujing","download_url":"https://codeload.github.com/DataXujing/CornerNet-Lite-Pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230043139,"owners_count":18163964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anchor-free","cornernet","cornernet-lite","cv","detection","python3","pytorch"],"created_at":"2024-12-17T00:00:17.525Z","updated_at":"2024-12-17T00:00:18.726Z","avatar_url":"https://github.com/DataXujing.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CornerNet-Lite: Training, Evaluation and Testing Code\nCode for reproducing results in the following paper:\n\n[**CornerNet-Lite: Efficient Keypoint Based Object Detection**](https://arxiv.org/abs/1904.08900)  \nHei Law, Yun Teng, Olga Russakovsky, Jia Deng  \n*arXiv:1904.08900* \n\n## Getting Started\n### Software Requirement\n- Python 3.7\n- PyTorch 1.0.0\n- CUDA 10\n- GCC 4.9.2 or above\n\n### Installing Dependencies\nPlease first install [Anaconda](https://anaconda.org) and create an Anaconda environment using the provided package list `conda_packagelist.txt`.\n```\nconda create --name CornerNet_Lite --file conda_packagelist.txt --channel pytorch\n```\n\nAfter you create the environment, please activate it.\n```\nsource activate CornerNet_Lite\n```\n\n### Compiling Corner Pooling Layers\nCompile the C++ implementation of the corner pooling layers. (GCC4.9.2 or above is required.)\n```\ncd \u003cCornerNet-Lite dir\u003e/core/models/py_utils/_cpools/\npython setup.py install --user\n```\n\n### Compiling NMS\nCompile the NMS code which are originally from [Faster R-CNN](https://github.com/rbgirshick/py-faster-rcnn/blob/master/lib/nms/cpu_nms.pyx) and [Soft-NMS](https://github.com/bharatsingh430/soft-nms/blob/master/lib/nms/cpu_nms.pyx).\n```\ncd \u003cCornerNet-Lite dir\u003e/core/external\nmake\n```\n\n### Downloading Models\nIn this repo, we provide models for the following detectors:\n- [CornerNet-Saccade](https://drive.google.com/file/d/1MQDyPRI0HgDHxHToudHqQ-2m8TVBciaa/view?usp=sharing)\n- [CornerNet-Squeeze](https://drive.google.com/file/d/1qM8BBYCLUBcZx_UmLT0qMXNTh-Yshp4X/view?usp=sharing)\n- [CornerNet](https://drive.google.com/file/d/1e8At_iZWyXQgLlMwHkB83kN-AN85Uff1/view?usp=sharing)\n\nPut the CornerNet-Saccade model under `\u003cCornerNet-Lite dir\u003e/cache/nnet/CornerNet_Saccade/`, CornerNet-Squeeze model under `\u003cCornerNet-Lite dir\u003e/cache/nnet/CornerNet_Squeeze/` and CornerNet model under `\u003cCornerNet-Lite dir\u003e/cache/nnet/CornerNet/`. (\\* Note we use underscore instead of dash in both the directory names for CornerNet-Saccade and CornerNet-Squeeze.)\n\nNote: The CornerNet model is the same as the one in the original [CornerNet repo](https://github.com/princeton-vl/CornerNet). We just ported it to this new repo.\n\n### Running the Demo Script\nAfter downloading the models, you should be able to use the detectors on your own images. We provide a demo script `demo.py` to test if the repo is installed correctly.\n```\npython demo.py\n```\nThis script applies CornerNet-Saccade to `demo.jpg` and writes the results to `demo_out.jpg`.\n\nIn the demo script, the default detector is CornerNet-Saccade. You can modify the demo script to test different detectors. For example, if you want to test CornerNet-Squeeze:\n```python\n#!/usr/bin/env python\n\nimport cv2\nfrom core.detectors import CornerNet_Squeeze\nfrom core.vis_utils import draw_bboxes\n\ndetector = CornerNet_Squeeze()\nimage    = cv2.imread(\"demo.jpg\")\n\nbboxes = detector(image)\nimage  = draw_bboxes(image, bboxes)\ncv2.imwrite(\"demo_out.jpg\", image)\n```\n\n### Using CornerNet-Lite in Your Project\nIt is also easy to use CornerNet-Lite in your project. You will need to change the directory name from `CornerNet-Lite` to `CornerNet_Lite`. Otherwise, you won't be able to import CornerNet-Lite.\n```\nYour project\n│   README.md\n│   ...\n│   foo.py\n│\n└───CornerNet_Lite\n│\n└───directory1\n│   \n└───...\n```\n\nIn `foo.py`, you can easily import CornerNet-Saccade by adding:\n```python\nfrom CornerNet_Lite import CornerNet_Saccade\n\ndef foo():\n    cornernet = CornerNet_Saccade()\n    # CornerNet_Saccade is ready to use\n\n    image  = cv2.imread('/path/to/your/image')\n    bboxes = cornernet(image)\n```\n\nIf you want to train or evaluate the detectors on COCO, please move on to the following steps.\n\n## Training and Evaluation\n\n### Installing MS COCO APIs\n```\nmkdir -p \u003cCornerNet-Lite dir\u003e/data\ncd \u003cCornerNet-Lite dir\u003e/data\ngit clone git@github.com:cocodataset/cocoapi.git coco\ncd \u003cCornerNet-Lite dir\u003e/data/coco/PythonAPI\nmake install\n```\n\n### Downloading MS COCO Data\n- Download the training/validation split we use in our paper from [here](https://drive.google.com/file/d/1dop4188xo5lXDkGtOZUzy2SHOD_COXz4/view?usp=sharing) (originally from [Faster R-CNN](https://github.com/rbgirshick/py-faster-rcnn/tree/master/data))\n- Unzip the file and place `annotations` under `\u003cCornerNet-Lite dir\u003e/data/coco`\n- Download the images (2014 Train, 2014 Val, 2017 Test) from [here](http://cocodataset.org/#download)\n- Create 3 directories, `trainval2014`, `minival2014` and `testdev2017`, under `\u003cCornerNet-Lite dir\u003e/data/coco/images/`\n- Copy the training/validation/testing images to the corresponding directories according to the annotation files\n\nTo train and evaluate a network, you will need to create a configuration file, which defines the hyperparameters, and a model file, which defines the network architecture. The configuration file should be in JSON format and placed in `\u003cCornerNet-Lite dir\u003e/configs/`. Each configuration file should have a corresponding model file in `\u003cCornerNet-Lite dir\u003e/core/models/`. i.e. If there is a `\u003cmodel\u003e.json` in `\u003cCornerNet-Lite dir\u003e/configs/`, there should be a `\u003cmodel\u003e.py` in `\u003cCornerNet-Lite dir\u003e/core/models/`. There is only one exception which we will mention later.\n\n### Training and Evaluating a Model\nTo train a model:\n```\npython train.py \u003cmodel\u003e\n```\n\nWe provide the configuration files and the model files for CornerNet-Saccade, CornerNet-Squeeze and CornerNet in this repo. Please check the configuration files in `\u003cCornerNet-Lite dir\u003e/configs/`.\n\nTo train CornerNet-Saccade:\n```\npython train.py CornerNet_Saccade\n```\nPlease adjust the batch size in `CornerNet_Saccade.json` to accommodate the number of GPUs that are available to you.\n\nTo evaluate the trained model:\n```\npython evaluate.py CornerNet_Saccade --testiter 500000 --split \u003csplit\u003e\n```\n\nIf you want to test different hyperparameters during evaluation and do not want to overwrite the original configuration file, you can do so by creating a configuration file with a suffix (`\u003cmodel\u003e-\u003csuffix\u003e.json`). There is no need to create `\u003cmodel\u003e-\u003csuffix\u003e.py` in `\u003cCornerNet-Lite dir\u003e/core/models/`.\n\nTo use the new configuration file:\n```\npython evaluate.py \u003cmodel\u003e --testiter \u003citer\u003e --split \u003csplit\u003e --suffix \u003csuffix\u003e\n```\n\nWe also include a configuration file for CornerNet under multi-scale setting, which is `CornerNet-multi_scale.json`, in this repo. \n\nTo use the multi-scale configuration file:\n```\npython evaluate.py CornerNet --testiter \u003citer\u003e --split \u003csplit\u003e --suffix multi_scale\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdataxujing%2Fcornernet-lite-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdataxujing%2Fcornernet-lite-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdataxujing%2Fcornernet-lite-pytorch/lists"}