{"id":13526228,"url":"https://github.com/longcw/yolo2-pytorch","last_synced_at":"2025-05-15T23:03:28.494Z","repository":{"id":43642503,"uuid":"82934344","full_name":"longcw/yolo2-pytorch","owner":"longcw","description":"YOLOv2 in PyTorch","archived":false,"fork":false,"pushed_at":"2021-09-29T09:54:02.000Z","size":4261,"stargazers_count":1566,"open_issues_count":87,"forks_count":418,"subscribers_count":49,"default_branch":"master","last_synced_at":"2025-05-15T23:02:54.995Z","etag":null,"topics":["darknet","detection","pytorch","yolo","yolo2"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/longcw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-23T14:19:09.000Z","updated_at":"2025-05-09T07:07:36.000Z","dependencies_parsed_at":"2022-09-18T23:03:14.008Z","dependency_job_id":null,"html_url":"https://github.com/longcw/yolo2-pytorch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcw%2Fyolo2-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcw%2Fyolo2-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcw%2Fyolo2-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcw%2Fyolo2-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/longcw","download_url":"https://codeload.github.com/longcw/yolo2-pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254436944,"owners_count":22070946,"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":["darknet","detection","pytorch","yolo","yolo2"],"created_at":"2024-08-01T06:01:26.638Z","updated_at":"2025-05-15T23:03:28.416Z","avatar_url":"https://github.com/longcw.png","language":"Python","funding_links":[],"categories":["Paper Implementations","Uncategorized","Other Versions of YOLO","Paper implementations｜论文实现","Paper implementations"],"sub_categories":["Uncategorized","Other libraries｜其他库:","Other libraries:"],"readme":"# YOLOv2 in PyTorch\n**NOTE: This project is no longer maintained and may not compatible with the newest pytorch (after 0.4.0).**\n\nThis is a [PyTorch](https://github.com/pytorch/pytorch)\nimplementation of YOLOv2.\nThis project is mainly based on [darkflow](https://github.com/thtrieu/darkflow)\nand [darknet](https://github.com/pjreddie/darknet).\n\nI used a Cython extension for postprocessing and \n`multiprocessing.Pool` for image preprocessing.\nTesting an image in VOC2007 costs about 13~20ms.\n\nFor details about YOLO and YOLOv2 please refer to their [project page](https://pjreddie.com/darknet/yolo/) \nand the [paper](https://arxiv.org/abs/1612.08242):\n*YOLO9000: Better, Faster, Stronger by Joseph Redmon and Ali Farhadi*.\n\n**NOTE 1:**\nThis is still an experimental project.\nVOC07 test mAP is about 0.71 (trained on VOC07+12 trainval,\nreported by [@cory8249](https://github.com/longcw/yolo2-pytorch/issues/23)).\nSee [issue1](https://github.com/longcw/yolo2-pytorch/issues/1) \nand [issue23](https://github.com/longcw/yolo2-pytorch/issues/23)\nfor more details about training.\n\n**NOTE 2:**\nI recommend to write your own dataloader using [torch.utils.data.Dataset](http://pytorch.org/docs/data.html)\nsince `multiprocessing.Pool.imap` won't stop even there is no enough memory space. \nAn example of `dataloader` for VOCDataset: [issue71](https://github.com/longcw/yolo2-pytorch/issues/71).\n\n**NOTE 3:**\nUpgrade to PyTorch 0.4: https://github.com/longcw/yolo2-pytorch/issues/59\n\n\n\n## Installation and demo\n1. Clone this repository\n    ```bash\n    git clone git@github.com:longcw/yolo2-pytorch.git\n    ```\n\n2. Build the reorg layer ([`tf.extract_image_patches`](https://www.tensorflow.org/api_docs/python/tf/extract_image_patches))\n    ```bash\n    cd yolo2-pytorch\n    ./make.sh\n    ```\n3. Download the trained model [yolo-voc.weights.h5 (link updated)](https://drive.google.com/file/d/0B4pXCfnYmG1WUUdtRHNnLWdaMEU/view?usp=sharing\u0026resourcekey=0-P9etgQJ4Mc9zOJ77qopoDw) \nand set the model path in `demo.py`\n4. Run demo `python demo.py`. \n\n## Training YOLOv2\nYou can train YOLO2 on any dataset. Here we train it on VOC2007/2012.\n\n1. Download the training, validation, test data and VOCdevkit\n\n    ```bash\n    wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar\n    wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar\n    wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCdevkit_08-Jun-2007.tar\n    ```\n\n2. Extract all of these tars into one directory named `VOCdevkit`\n\n    ```bash\n    tar xvf VOCtrainval_06-Nov-2007.tar\n    tar xvf VOCtest_06-Nov-2007.tar\n    tar xvf VOCdevkit_08-Jun-2007.tar\n    ```\n\n3. It should have this basic structure\n\n    ```bash\n    $VOCdevkit/                           # development kit\n    $VOCdevkit/VOCcode/                   # VOC utility code\n    $VOCdevkit/VOC2007                    # image sets, annotations, etc.\n    # ... and several other directories ...\n    ```\n    \n4. Since the program loading the data in `yolo2-pytorch/data` by default,\nyou can set the data path as following.\n    ```bash\n    cd yolo2-pytorch\n    mkdir data\n    cd data\n    ln -s $VOCdevkit VOCdevkit2007\n    ```\n    \n5. Download the [pretrained darknet19 model (link updated)](https://drive.google.com/file/d/0B4pXCfnYmG1WRG52enNpcV80aDg/view?usp=sharing\u0026resourcekey=0-LUq4HFw9tSLKqMcPZeWsaQ)\nand set the path in `yolo2-pytorch/cfgs/exps/darknet19_exp1.py`.\n\n7. (optional) Training with TensorBoard.\n\n    To use the TensorBoard, \n    set `use_tensorboard = True` in `yolo2-pytorch/cfgs/config.py`\n    and install TensorboardX (https://github.com/lanpa/tensorboard-pytorch).\n    Tensorboard log will be saved in `training/runs`.\n\n\n6. Run the training program: `python train.py`.\n\n\n## Evaluation\n\nSet the path of the `trained_model` in `yolo2-pytorch/cfgs/config.py`.\n```bash\ncd faster_rcnn_pytorch\nmkdir output\npython test.py\n```\n## Training on your own data\n\nThe forward pass requires that you supply 4 arguments to the network:\n\n- `im_data` - image data.  \n  - This should be in the format `C x H x W`, where `C` corresponds to the color channels of the image and `H` and `W` are the height and width respectively.  \n  - Color channels should be in RGB format.  \n  - Use the `imcv2_recolor` function provided in `utils/im_transform.py` to preprocess your image.  Also, make sure that images have been resized to `416 x 416` pixels\n- `gt_boxes` - A list of `numpy` arrays, where each one is of size `N x 4`, where `N` is the number of features in the image.  The four values in each row should correspond to `x_bottom_left`, `y_bottom_left`, `x_top_right`, and `y_top_right`.  \n- `gt_classes` - A list of `numpy` arrays, where each array contains an integer value corresponding to the class of each bounding box provided in `gt_boxes`\n- `dontcare` - a list of lists\n\nLicense: MIT license (MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongcw%2Fyolo2-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flongcw%2Fyolo2-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongcw%2Fyolo2-pytorch/lists"}