Skip to content

Commit

Permalink
Fix minor issues for final release
Browse files Browse the repository at this point in the history
  • Loading branch information
washingtonsk8 committed Mar 31, 2022
1 parent a5df6ad commit 97b5f27
Show file tree
Hide file tree
Showing 16 changed files with 12,039 additions and 23 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ rl_fast_forward/eval/*.json
rl_fast_forward/eval/*.npz
rl_fast_forward/eval/*.txt
rl_fast_forward/logs/*
rl_fast_forward/resources/YouCook2/*
rl_fast_forward/resources/COIN/*

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ We provide convinient demos in CoLab.
| **Description** | **Link** |
|--------------------------------|-------------------------------|
| Process a video using our agent | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/verlab/TextDrivenVideoAcceleration_TPAMI_2022/blob/main/TextDrivenVideoAcceleration_TPAMI_2022.ipynb) |
| Train VDAN+ using VaTeX | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/verlab/TextDrivenVideoAcceleration_TPAMI_2022/blob/main/demos/train_VDAN.ipynb) |
| Train VDAN+ using VaTeX | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/verlab/TextDrivenVideoAcceleration_TPAMI_2022/blob/main/demos/train_VDAN+.ipynb) |
| Train the agent using YouCook2 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/verlab/TextDrivenVideoAcceleration_TPAMI_2022/blob/main/demos/train_SAFFA.ipynb) |
| Extract VDAN+ feats from a video | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/verlab/TextDrivenVideoAcceleration_TPAMI_2022/blob/main/demos/extract_VDAN+_feats.ipynb) |
| Extract VDAN+ feats from a video | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/verlab/TextDrivenVideoAcceleration_TPAMI_2022/blob/main/demos/extract_VDAN%2B_feats.ipynb) |


Data \& Code Preparation
Expand Down
28 changes: 20 additions & 8 deletions TextDrivenVideoAcceleration_TPAMI_2022.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
" 'roll it up and press firmly',\n",
" 'cut the roll into small rolls']\n",
"\n",
"! yt-dlp https://www.youtube.com/watch?v=$VIDEO_ID -o $VIDEO_ID --merge-output-format mp4 # Download Video File\n",
"# ! yt-dlp https://www.youtube.com/watch?v=$VIDEO_ID -o $VIDEO_ID --merge-output-format mp4 # Download Video File\n",
"\n",
"sf = model.fast_forward_video(video_filename=f'/content/{VIDEO_ID}.mp4',\n",
"sf = model.fast_forward_video(video_filename=f'{VIDEO_ID}.mp4',\n",
" document=document,\n",
" desired_speedup=12,\n",
" output_video_filename=f'/content/{VIDEO_ID}_FF.avi')"
" output_video_filename=f'{VIDEO_ID}_FF.avi')"
]
},
{
Expand All @@ -85,20 +85,20 @@
},
"outputs": [],
"source": [
"! wget -O /content/youcookii_annotations_trainval.tar.gz http://youcook2.eecs.umich.edu/static/YouCookII/youcookii_annotations_trainval.tar.gz\n",
"! tar -xf /content/youcookii_annotations_trainval.tar.gz -C /content/\n",
"! rm /content/youcookii_annotations_trainval.tar.gz\n",
"! wget -O youcookii_annotations_trainval.tar.gz http://youcook2.eecs.umich.edu/static/YouCookII/youcookii_annotations_trainval.tar.gz\n",
"! tar -xf youcookii_annotations_trainval.tar.gz\n",
"! rm youcookii_annotations_trainval.tar.gz\n",
"\n",
"import json\n",
"import cv2\n",
"import numpy as np\n",
"from matplotlib import pyplot as plt\n",
"\n",
"annotations = json.load(open('/content/youcookii_annotations_trainval.json'))\n",
"annotations = json.load(open('youcookii_annotations_trainval.json'))\n",
"\n",
"video_annotations = annotations['database'][VIDEO_ID]['annotations']\n",
"cmap = plt.cm.get_cmap('hsv', len(video_annotations) + 1)\n",
"video_fps = cv2.VideoCapture(f'/content/{VIDEO_ID}.mp4').get(5)\n",
"video_fps = cv2.VideoCapture(f'{VIDEO_ID}.mp4').get(5)\n",
"for idx, region in enumerate(video_annotations):\n",
" video_region = region['segment']\n",
" plt.axvspan(round(video_region[0] * video_fps), round(video_region[1] * video_fps), alpha=0.5, color=cmap(idx))\n",
Expand Down Expand Up @@ -132,6 +132,18 @@
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"1acbabb6aa4149b8a2e642c3c95928db": {
Expand Down
42 changes: 34 additions & 8 deletions demos/train_SAFFA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "kFWPY-CkNGNM"
"id": "kFWPY-CkNGNM",
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand All @@ -37,10 +40,15 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "E44GxN1MshGm"
"id": "E44GxN1MshGm",
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
"%cd rl_fast_forward\n",
"\n",
"# Download YouCook2's VDAN+ video feats\n",
"! wget -O resources/YouCook2/VDAN+/youcook2_vdan+_vid_feats.zip https://verlab.dcc.ufmg.br/TextDrivenVideoAcceleration/youcook2_vdan+_vid_feats.zip\n",
"! unzip -q resources/YouCook2/VDAN+/youcook2_vdan+_vid_feats.zip -d resources/YouCook2/VDAN+/vid_feats/\n",
Expand All @@ -65,7 +73,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "ob36PdmcizC3"
"id": "ob36PdmcizC3",
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand All @@ -90,7 +101,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "pOhfi2rfroRR"
"id": "pOhfi2rfroRR",
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand All @@ -105,7 +119,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "D9idcdl7uONY"
"id": "D9idcdl7uONY",
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand All @@ -123,7 +140,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "3rpoXYNP2Sqf"
"id": "3rpoXYNP2Sqf",
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand All @@ -145,7 +165,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "ZXT5Qa1j0LD_"
"id": "ZXT5Qa1j0LD_",
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand All @@ -172,7 +195,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "FC2ZXM3Yhplc"
"id": "FC2ZXM3Yhplc",
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ matplotlib==3.4.2
nltk==3.6.2
numpy==1.20.3
opencv_python==4.5.2.54
pandas==1.4.1
pandas==1.3.5
pandas_stubs==1.2.0.39
Pillow==9.0.1
scipy==1.7.0
Expand Down
1 change: 1 addition & 0 deletions rl_fast_forward/resources/COIN/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This folder contains all files from the COIN dataset.
1 change: 1 addition & 0 deletions rl_fast_forward/resources/COIN/VDAN+/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This folder will store the VDAN+ features extracted from the YouCook2 videos
4 changes: 4 additions & 0 deletions rl_fast_forward/resources/COIN/VDAN+/doc_feats/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
4 changes: 4 additions & 0 deletions rl_fast_forward/resources/COIN/VDAN+/vid_feats/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
Loading

0 comments on commit 97b5f27

Please sign in to comment.