Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
34731381
Commit
34731381
authored
May 17, 2021
by
Dan Kondratyuk
Committed by
A. Unique TensorFlower
May 17, 2021
Browse files
Fix movinet colab references.
PiperOrigin-RevId: 374217229
parent
e04eb07b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
official/vision/beta/projects/movinet/movinet_tutorial.ipynb
official/vision/beta/projects/movinet/movinet_tutorial.ipynb
+21
-13
No files found.
official/vision/beta/projects/movinet/movinet_tutorial.ipynb
View file @
34731381
...
...
@@ -40,7 +40,7 @@
},
"outputs": [],
"source": [
"!pip install -q tf-models-nightly\n",
"!pip install -q tf-models-nightly
tfds-nightly
\n",
"\n",
"!command -v ffmpeg \u003e/dev/null || (apt update \u0026\u0026 apt install -y ffmpeg)\n",
"!pip install -q mediapy"
...
...
@@ -54,7 +54,6 @@
},
"outputs": [],
"source": [
"from io import BytesIO\n",
"import os\n",
"from six.moves import urllib\n",
"\n",
...
...
@@ -68,7 +67,7 @@
"\n",
"from official.vision.beta.configs import video_classification\n",
"from official.vision.beta.projects.movinet.configs import movinet as movinet_configs\n",
"from official.vision.beta.projects.movinet.modeling import movinet
as movinet_backbone
\n",
"from official.vision.beta.projects.movinet.modeling import movinet\n",
"from official.vision.beta.projects.movinet.modeling import movinet_layers\n",
"from official.vision.beta.projects.movinet.modeling import movinet_model"
]
...
...
@@ -138,7 +137,7 @@
"image_width = 224\n",
"\n",
"with urllib.request.urlopen(image_url) as f:\n",
" image = Image.open(
BytesIO(f.read())
).resize((image_height, image_width))\n",
" image = Image.open(
f
).resize((image_height, image_width))\n",
"video = tf.reshape(np.array(image), [1, 1, image_height, image_width, 3])\n",
"video = tf.cast(video, tf.float32) / 255.\n",
"\n",
...
...
@@ -200,6 +199,22 @@
"Calling `download_and_prepare()` will automatically download the dataset. After downloading, this cell will output information about the dataset."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "FxM1vNYp_YAM"
},
"outputs": [],
"source": [
"dataset_name = 'ucf101'\n",
"\n",
"builder = tfds.builder(dataset_name)\n",
"\n",
"config = tfds.download.DownloadConfig(verify_ssl=False)\n",
"builder.download_and_prepare(download_config=config)"
]
},
{
"cell_type": "code",
"execution_count": null,
...
...
@@ -281,11 +296,6 @@
}
],
"source": [
"dataset_name = 'ucf101'\n",
"\n",
"builder = tfds.builder(dataset_name)\n",
"builder.download_and_prepare()\n",
"\n",
"num_classes = builder.info.features['label'].num_classes\n",
"num_examples = {\n",
" name: split.num_examples\n",
...
...
@@ -407,12 +417,10 @@
"tf.keras.backend.clear_session()\n",
"\n",
"backbone = movinet.Movinet(\n",
" model_id=model_id,\n",
" stochastic_depth_rate=0.)\n",
" model_id=model_id)\n",
"model = movinet_model.MovinetClassifier(\n",
" backbone=backbone,\n",
" num_classes=600,\n",
" dropout_rate=0.)\n",
" num_classes=600)\n",
"model.build([batch_size, num_frames, resolution, resolution, 3])\n",
"\n",
"# Load pretrained weights from TF Hub\n",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment