{"id":19121140,"url":"https://github.com/aras62/sf-gru","last_synced_at":"2025-08-20T20:33:08.907Z","repository":{"id":104726371,"uuid":"197487517","full_name":"aras62/SF-GRU","owner":"aras62","description":"Pedestrian Action Anticipation using Contextual Feature Fusion in Stacked RNNs","archived":false,"fork":false,"pushed_at":"2024-10-27T16:33:04.000Z","size":49996,"stargazers_count":45,"open_issues_count":2,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-07T20:50:09.681Z","etag":null,"topics":["action-anticipation","autonomous-driving","behavior-analysis","computer-vision-algorithms","prediction"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/aras62.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-18T01:19:37.000Z","updated_at":"2024-12-12T03:06:40.000Z","dependencies_parsed_at":"2024-12-19T15:20:45.798Z","dependency_job_id":null,"html_url":"https://github.com/aras62/SF-GRU","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aras62/SF-GRU","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aras62%2FSF-GRU","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aras62%2FSF-GRU/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aras62%2FSF-GRU/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aras62%2FSF-GRU/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aras62","download_url":"https://codeload.github.com/aras62/SF-GRU/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aras62%2FSF-GRU/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271378694,"owners_count":24749196,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["action-anticipation","autonomous-driving","behavior-analysis","computer-vision-algorithms","prediction"],"created_at":"2024-11-09T05:16:13.245Z","updated_at":"2025-08-20T20:33:03.605Z","avatar_url":"https://github.com/aras62.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SF-GRU\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"sf_gru_diagram.png\" alt=\"sf-gru\" align=\"middle\" width=\"600\"/\u003e\n\u003c/p\u003e\n\nThis is the python implementation for paper **[A. Rasouli, I. Kotseruba, and J. K. Tsotsos, \"Pedestrian Action Anticipation using Contextual Feature Fusion in Stacked RNNs\", BMVC 2019.](https://arxiv.org/pdf/2005.06582)**\n\n\n### Table of contents\n* [Dependencies](#dependencies)\n* [Datasets](#datasets)\n* [Train](#train)\n* [Test](#test)\n* [Citation](#citation)\n* [Authors](#authors)\n* [License](#license)\n\n\n\u003ca name=\"dependencies\"\u003e\u003c/a\u003e\n## Dependencies\nThe interface is written and tested using python 3.5. The interface also requires\nthe following external libraries:\u003cbr/\u003e\n* tensorflow (tested with 1.9 and 1.14)\n* keras (tested with 2.1 and 2.2)\n* scikit-learn\n* numpy\n* pillow\n\n\u003ca name=\"datasets\"\u003e\u003c/a\u003e\n## Datasets\nThe code is trained and tested with [PIE](http://data.nvision2.eecs.yorku.ca/PIE_dataset/) and [JAAD](http://data.nvision2.eecs.yorku.ca/JAAD_dataset/)  datasets. We used the keras implementation of [open-pose](https://github.com/rachit2403/Open-Pose-Keras) to generate poses for the PIE dataset. They can be found at `data/features/pie/poses`.\n\n\n\u003ca name=\"train\"\u003e\u003c/a\u003e\n## Train\nA sample training script is provided below:\n\n```\nfrom sf_gru import SFGRU\nfrom pie_data import PIE\n\ndata_opts = { 'seq_type': 'crossing',\n              'data_split_type': 'random',\n               ... }\nimdb = PIE(data_path=\u003cpath_to_pie\u003e)\n\nmodel_opts = {'obs_input_type': ['local_box', 'local_context', 'pose', 'box', 'speed'],\n              ...}\n\nmethod_class = SFGRU()\nbeh_seq_train = imdb.generate_data_trajectory_sequence('train', **data_opts)\nsaved_files_path = method_class.train(beh_seq_train)\n\n```\n`from pie_data import PIE` imports the data interface. Download the interface from the corresponding annotation repository.\u003cbr/\u003e\n`data_opts = { 'seq_type': 'crossing', ... }` specifies the data generation parameters form the dataset. Make sure that `seq_type` is set to `'crossing'`.  Refer to `generate_data_trajectory_sequence()` method in corresponding interface for more information. \u003cbr/\u003e\n`model_opts = {...}` specifies how the training data should be prepared for the model. Refer to `sf_gru.py:get_data()` for more\ninformation on how to set the parameters. \u003cbr/\u003e\n`method_class = SFGRU()` instantiates an object of type SFGRU. \u003cbr/\u003e\n`imdb.generate_data_trajectory_sequence()` generate data sequences from the dataset interface.\u003cbr/\u003e\n`method_class.train()` trains the model and returns the path to the folder where model and data processing\nparameters are saved.\n\nA sample of training code can be found in `train_test.py`. All the default parameters in the script replicate the conditions in which the model was trained for the paper. Note that since `'random'` split data is used, the model may yield different performance at test time.\n\n\n\u003ca name=\"test\"\u003e\u003c/a\u003e\n## Test\nA sample test script is provided below\n```\nfrom sf_gru import SFGRU\nfrom pie_data import PIE\n\ndata_opts = { 'seq_type': 'crossing',\n              'data_split_type': 'random',\n               ... }\nimdb = PIE(data_path=\u003cpath_to_pie\u003e)\n\nmethod_class = SFGRU()\nbeh_seq_test = imdb.generate_data_trajectory_sequence('test', **data_opts)\nsaved_files_path = \u003cpath_to_model_folder\u003e\nacc , auc, f1, precision, recall = method_class.test(beh_seq_test, saved_files_path)\n```\nThe procedure is similar to train with the exception that there is no need to specify `model_opts` as they Are\nsaved in the model folder at train time.\u003cbr/\u003e\nIn the case only test is run without training, `saved_files_path` should be specified. It should be the path to the folder where model and training parameters are saved. The final model used for the paper can be found at `data/models/pie/sf-rnn`. Note that if test follows train, the path is returned by `train()` function.\u003cbr/\u003e\n`method_class.test()` test the performance of the model and return the results using the following 5 metrics `acc` (accuracy) , `auc` (area under curve), `f1`, `precision` and `recall`. A sample of training code can be found in `train_test.py`.\n\n\n\u003ca name=\"citation\"\u003e\u003c/a\u003e\n# Citation\nIf you use our dataset, please cite:\n```\n@inproceedings{rasouli2017they,\n  title={Pedestrian Action Anticipation using Contextual Feature Fusion in Stacked RNNs},\n  author={Rasouli, Amir and Kotseruba, Iuliia and Tsotsos, John K},\n  booktitle={BMVC},\n  year={2019}\n}\n\n```\n\u003ca name=\"authors\"\u003e\u003c/a\u003e\n## Authors\n\n* **[Amir Rasouli](https://aras62.github.io/)**\n* **[Iuliia Kotseruba](http://www.cse.yorku.ca/~yulia_k/)**\n\nPlease send email to arasouli.ai@gmail.com or yulia_k@eecs.yorku.ca if there are any problems with downloading or using the data.\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n## License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faras62%2Fsf-gru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faras62%2Fsf-gru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faras62%2Fsf-gru/lists"}