{"id":14985988,"url":"https://github.com/gudongfeng/3d-densenet","last_synced_at":"2025-04-11T20:31:45.108Z","repository":{"id":77359956,"uuid":"85851546","full_name":"gudongfeng/3d-DenseNet","owner":"gudongfeng","description":"3D Dense Connected Convolutional Network (3D-DenseNet for action recognition)","archived":false,"fork":false,"pushed_at":"2018-11-25T19:06:57.000Z","size":707,"stargazers_count":119,"open_issues_count":13,"forks_count":52,"subscribers_count":6,"default_branch":"sagemaker","last_synced_at":"2025-03-25T18:15:26.201Z","etag":null,"topics":["action","cnn","densenet","recognition","sagemaker"],"latest_commit_sha":null,"homepage":"","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/gudongfeng.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-03-22T16:31:36.000Z","updated_at":"2024-12-30T12:19:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"a7ad8da4-a242-4b18-af52-50e025cbabfc","html_url":"https://github.com/gudongfeng/3d-DenseNet","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/gudongfeng%2F3d-DenseNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gudongfeng%2F3d-DenseNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gudongfeng%2F3d-DenseNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gudongfeng%2F3d-DenseNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gudongfeng","download_url":"https://codeload.github.com/gudongfeng/3d-DenseNet/tar.gz/refs/heads/sagemaker","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248476320,"owners_count":21110256,"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":["action","cnn","densenet","recognition","sagemaker"],"created_at":"2024-09-24T14:12:05.792Z","updated_at":"2025-04-11T20:31:40.091Z","avatar_url":"https://github.com/gudongfeng.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 3D-DenseNet with TensorFlow (Train in AWS sagemaker)\n\n## Get started !!\n### Dependencies\n- Tensorflow 1.11\n- python 3.6.5\n- opencv-python 3.4.3.18\n- Pillow 5.3.0 \n- sagemaker 1.15.2\n\n\n### Data preparation\n1. Download the video dataset and make sure it has the following folder structure (`../video/\u003caction_name\u003e/\u003cvideo1.avi\u003e` KTH ex: ../kth_video/boxing/person01_boxing_d1_uncomp.avi)\n2. Run the `prepare_data_main.py`. You need to specify the `data_dir`, `train_output_path`, and `eval_output_path`. \n  - `data_dir`: `../kth_video`\n3. When the script finished. It will print out the following informations\n  - Total clips in train dataset: `AAAA` (Take a record of this number)\n  - Total clips in eval dataset: `BBBB` (Take a record of this number)\n\n### Train (Local)\n1. Paste the number `AAAA` from previous step to `train_total_video_clip` in the `debug_train.py` file.\n2. Paste the number `BBBB` from previous step to `eval_total_video_clip` in the `debug_train.py` file.\n3. Copy and paste the `eval.tfrecord` and `train.tfrecord` file generated from the previous step to a folder named `../tfrecord`.\n4. Set the `DATA_DIR` in the `debug_train.py` to the proper folder name in the previous step.\n5. Run `python debug_train.py` (Make sure you have all the dependencies).\n\n### Train (AWS sagemaker)\n**Note: It turns out Sagemaker doesn't support python3 for Tensorflow script at this moment (2018.Nov.1)!!!**\n**So I will stop working on this part and left the `sagemaker_main.template` file as it is for now.**\n1. Register AWS account. [AWS Console](https://console.aws.amazon.com)\n2. Create an IAM user with only `Programmatic access` and attached `AmazonS3FullAccess` and `AmazonSageMakerFullAccess` to this IAM user. Keep a record of your `Access Key ID` and `Secret Access Key` (**Don't tell anyone this information!!! Even your husband/wife**).\n3. Install [boto3](https://aws.amazon.com/sdk-for-python/) on your local desktop. Run `aws configure` in your console and paste the `Access Key ID` and `Secret Access Key` from previous step. Keep in mind the region (ex: `us-west-2`) that you used.\n4. Create a new Role with name `sagemaker-full-access-role` and attach an inline policy with the following [JSON](http://gudongfeng.me/sagemaker-role-inline-policy.txt)\n5. Create a new S3 bucekt with whatever name you want in the same region in Step3. Let said the S3 bucket name is `machine_leaning_data_bucket`.\n6. Rename the `sagemaker_main.template` to `sagemaker_main.py`\n7. Copy the new Role ARN (ex: `arn:aws:iam::\u003caws_account_id\u003e:role/sagemaker-full-access-role`) and paste it to the `role` value in the `sagemaker_main.py`\n8. Replace the `\u003cs3_bucket_name\u003e` in `sagemaker_main.py` with S3 bucket name `machine_leaning_data_bucket` (Whatever S3 bucket name you have).\n9. Chooes one option in the `sagemaker_main.py` and run `python sagemaker_main.py`. Notice that if you choose \n\u003e As I said at the beginning, sagemaker doesn't support tensorflow docker image with python version 3, so you will get error `Attempted relative import in non-package` at this moment. I will try to rework this file once sagemaker support it. \n\n## Background\nExpand the `Densely Connected Convolutional Networks [DenseNets](https://arxiv.org/abs/1608.06993) to 3D-DenseNet for action recognition (video classification):\n\n- 3D-DenseNet - without bottleneck layers\n- 3D-DenseNet-BC - with bottleneck layers\n\nEach model can be tested on such datasets:\n\n- [KTH](http://www.nada.kth.se/cvap/actions/)\n- [MERL](http://www.merl.com/demos/merl-shopping-dataset)\n\nA number of layers, blocks, growth rate, video normalization and other training params may be changed trough shell or inside the source code.\n\nThere are also many [other implementations](https://github.com/liuzhuang13/DenseNet), they may be useful also.\n\n## Reference\n\n[Thesis](https://ruor.uottawa.ca/bitstream/10393/36739/1/Gu_Dongfeng_2017_thesis.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgudongfeng%2F3d-densenet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgudongfeng%2F3d-densenet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgudongfeng%2F3d-densenet/lists"}