{"id":20780744,"url":"https://github.com/farrajota/fastrcnn-example-torch","last_synced_at":"2026-04-21T00:33:15.691Z","repository":{"id":202488730,"uuid":"92414026","full_name":"farrajota/fastrcnn-example-torch","owner":"farrajota","description":"Example code on how to use the fastrcnn package for torch7","archived":false,"fork":false,"pushed_at":"2017-12-05T16:20:55.000Z","size":441,"stargazers_count":3,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T08:46:40.221Z","etag":null,"topics":["fast-rcnn","samplecode","torch7"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/farrajota.png","metadata":{"files":{"readme":"README.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}},"created_at":"2017-05-25T14:53:49.000Z","updated_at":"2024-02-07T09:39:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"8fbdd7d5-bd77-41db-82b8-ab9dde2393f9","html_url":"https://github.com/farrajota/fastrcnn-example-torch","commit_stats":null,"previous_names":["farrajota/fastrcnn-example-torch"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farrajota%2Ffastrcnn-example-torch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farrajota%2Ffastrcnn-example-torch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farrajota%2Ffastrcnn-example-torch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farrajota%2Ffastrcnn-example-torch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farrajota","download_url":"https://codeload.github.com/farrajota/fastrcnn-example-torch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243125170,"owners_count":20240263,"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":["fast-rcnn","samplecode","torch7"],"created_at":"2024-11-17T13:39:01.878Z","updated_at":"2025-12-25T00:44:28.597Z","avatar_url":"https://github.com/farrajota.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fast R-CNN example code\n\nThis example code showcases the use of the Fast R-CNN package for training and testing a network for object detection.\n\n\n## Installation\n\n### Requirements\n\n- NVIDIA GPU with compute capability 3.5+ (2GB+ ram)\n- [Torch7](http://torch.ch/docs/getting-started.html)\n- [Fast-RCNN package](https://github.com/farrajota/fast-rcnn-torch)\n- [dbcollection](https://github.com/farrajota/dbcollection)\n\n### Packages/dependencies installation\n\nTo use this example code, some packages are required for it to work: `fastrcnn` and `dbcollection`.\n\n#### fastrcnn\n\nTo install the Fast R-CNN package do the following:\n\n- install all the necessary dependencies.\n\n```bash\nluarocks install tds\nluarocks install cudnn\nluarocks install inn\nluarocks install matio\nluarocks install torchnet\n```\n\n- download and install the package.\n\n```bash\ngit clone https://github.com/farrajota/fast-rcnn-torch\ncd fast-rcnn-torch \u0026\u0026 luarocks make rocks/*\n```\n\n\u003e For more information about the `fastrcnn` package see [here](https://github.com/farrajota/fast-rcnn-torch).\n\n#### dbcollection\n\nTo install the dbcollection package do the following:\n\n- install the Python module.\n\n    ```\n    pip install dbcollection==0.1.7\n    ```\n\n    or\n\n    ```\n    conda install -c farrajota dbcollection==0.1.7\n    ```\n\n- install the Lua/Torch7 dbcollection wrapper:\n\n    1. download the Lua/Torch7 git repo to disk.\n\n    ```\n    git clone https://github.com/dbcollection/dbcollection-torch7\n    ```\n\n    2. install the package.\n    ```\n    cd dbcollection-torch7 \u0026\u0026 luarocks make\n    ```\n\n\u003e For more information about the dbcollection package see [here](https://github.com/dbcollection/dbcollection-torch7).\n\n\n# Usage\n\nTo start using the code, clone this repo to your home directory:\n\n```\ngit clone https://github.com/farrajota/fastrcnn-example-torch\n```\n\nIf you clone the repo into a different directory, please make sure you modify `projectdir.lua` and point to the new path before using the code.\n\n## Data setup\n\nThe necessary data is available for download by calling the following command in the terminal:\n\n```bash\nth download/download_all.lua\n```\n\nThis will download the following data:\n\n- pre-trained models on Imagenet\n- pre-processed roi proposals on the caltech pedestrian dataset\n- annotations in the COCO format for evaluating the network accuracy using the 'coco' evaluation protocol.\n\n\n\u003e Note: this data can also be downloaded manually by following the next steps.\n\n\n### Pre-trained models\n\nSeveral pre-trained models are available to be used in this example code. To download these networks, simply run the following command in the terminal (assuming you are in the root dir of the repo):\n\n```bash\nth download/download_pretrained_models.lua\n```\n\nThis will download the following network types pretrained on the ImageNet ILSVRC2012 dataset: alexnet, zeilernet, googlenet, vgg and resnet\n\n### RoI Proposals\n\nTo download the roi proposals, simply run the following command in the terminal (again, assuming you are in the root dir of the repo):\n\n```bash\nth download/download_roi_proposals.lua\n```\n\n### Datasets\n\nTo run the example code, the user can let the script handle the data download and setup.\n\nHowever, if the user already has downloaded the data to disk, it is advisable to manually setup the dataset before runing the script to avoid downloading the data to disk.\n\nTo do this you can do the following:\n\n```lua\ndbc = require 'dbcollection.manager'\ndbc.add{name='pascal_voc_2007', data_dir='path/to/dataset', task={}, file_path={}}\n```\n\nEven if you don't have the dataset, it is best to manually setup the dataset because this way you can specify the path where data will be stored on disk. Like the previous example, to setup a dataset's data you simply need to do the following:\n\n```lua\ndbc = require 'dbcollection.manager'\ndbc.load{name='pascal_voc_2007', data_dir='save/dir/path'}\n```\n\n\u003e Note: If no path is provided, the dataset will be stored in the `~/dbcollection/\u003cdataset_name\u003e/data/` directory in your home path.\n\n#### Available datasets\n\nThe following datasets are available for training/testing an object detector using this repo:\n\n- [Pascal VOC 2007](http://host.robots.ox.ac.uk/pascal/VOC/voc2007/index.html)\n- [Pascal VOC 2012](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/index.html)\n- [Microsoft COCO](http://mscoco.org/)\n\n\u003e Note: For a list of all available datasets fro train/test check `options.lua`.\n\n\n## Train and test a model using the example code\n\nThis repository contains scripts for training and testing an object detector network using a pre-trained network on ImageNet for feature extraction such as the alexnet or resnet.\n\n\u003e Note: several options are available for configuring the training/testing parameters (see `options.lua` for a complete set of available parameters).\n\n\n### Training a network\n\nTo train a model run `th train.lua`. To change the default settings, use the input arguments of your choice. To see all available option's parameters do `th train.lua --help` or check `options.lua`.\n\n* You can select one of the following imagenet pre-trained networks for feature extraction: AlexNet, ZeilerNet, VGG (16, 19), ResNet (19, 34, 50, 101, 152, 200), and GoogleNet v3.\n\n* Snapshots of the network's training procedure are stored to disk other information such as the configuration file, loss logs and model parameters of the training procedure (default path is `./data/exp`). You can change this directory by passing the `-expDir`new path to save the experiment option.\n\n\n### Testing a network (mAP accuracy)\n\n\nTo test a network's accuracy, run `th test.lua` and define the `-expID`, `-dataset` and `-expDir` input options (if changed) to compute the mean average-precision.\n\n\u003e Note: Network evaluation (test) only uses a single GPU for inference.\n\n\n### Scripts\n\nIn the `scripts/` folder there are several pre-configured example scripts for training and testing a network. To run a script just call them  like this:\n\n```\nth scripts/train_test_alexnet_voc2007.lua\n```\n\n### Running the demo\n\nTo run the basic demo code you'll first need to train a network model. After this is done, just simply run the demo on the terminal:\n\n```lua\nqlua demo.lua -expID \u003cexp_name\u003e -dataset \u003cdataset_name\u003e\n```\n\nAfter running the demo you should see something like this:\n\n![alt text](data/demo/demo_detections.png \"Detections with AlexNet\")\n\n\u003e Note: This image was taken from this [repo](https://github.com/mahyarnajibi/fast-rcnn-torch). In the demo script a random image is selected from the test set and displayed. To change the generated image just modify the `-manualSeed` value.\n\n\n# License\n\nMIT license (see the LICENSE file)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarrajota%2Ffastrcnn-example-torch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarrajota%2Ffastrcnn-example-torch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarrajota%2Ffastrcnn-example-torch/lists"}