C3D tensorflow estimator implementation
- Tensorflow 1.11
- python 3.6.5
- opencv-python 3.4.3.18
- Pillow 5.3.0
- sagemaker 1.12.0
- Download the video dataset and make sure it has the following folder structure (
../video/<action_name>/<video1.avi>KTH ex: ../kth_video/boxing/person01_boxing_d1_uncomp.avi) - Run the
prepare_data_main.py. You need to specify thedata_dir,train_output_path, andeval_output_path.
data_dir:../kth_video
- When the script finished. It will print out the following informations
- Total clips in train dataset:
AAAA(Take a record of this number) - Total clips in eval dataset:
BBBB(Take a record of this number)
- Paste the number
AAAAfrom previous step totrain_total_video_clipin thedebug_train.pyfile. - Paste the number
BBBBfrom previous step toeval_total_video_clipin thedebug_train.pyfile. - Copy and paste the
eval.tfrecordandtrain.tfrecordfile generated from the previous step to a folder named../tfrecord. - Set the
DATA_DIRin thedebug_train.pyto the proper folder name in the previous step. - Run
python debug_train.py(Make sure you have all the dependencies).
Note: It turns out Sagemaker doesn't support python3 for Tensorflow script at this moment (2018.Nov.1)!!!
So I will stop working on this part and left the sagemaker_main.template file as it is for now.
- Register AWS account. AWS Console
- Create an IAM user with only
Programmatic accessand attachedAmazonS3FullAccessandAmazonSageMakerFullAccessto this IAM user. Keep a record of yourAccess Key IDandSecret Access Key(Don't tell anyone this information!!! Even your husband/wife). - Install boto3 on your local desktop. Run
aws configurein your console and paste theAccess Key IDandSecret Access Keyfrom previous step. Keep in mind the region (ex:us-west-2) that you used. - Create a new Role with name
sagemaker-full-access-roleand attach an inline policy with the following JSON - 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. - Rename the
sagemaker_main.templatetosagemaker_main.py - Copy the new Role ARN (ex:
arn:aws:iam::<aws_account_id>:role/sagemaker-full-access-role) and paste it to therolevalue in thesagemaker_main.py - Replace the
<s3_bucket_name>insagemaker_main.pywith S3 bucket namemachine_leaning_data_bucket(Whatever S3 bucket name you have). - Chooes one option in the
sagemaker_main.pyand runpython sagemaker_main.py. Notice that if you choose
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-packageat this moment. I will try to rework this file once sagemaker support it.