Merge pull request #636 from orbisai0security/fix-v003-vgg16-weights-integrity-check

fix: remove unsafe exec() in TransferLearningTF.ipynb
This commit is contained in:
Lee Stott 2026-07-06 16:46:18 +01:00 committed by GitHub
commit 2d45a02c08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 1 deletions

View File

@ -497,7 +497,17 @@
}
],
"source": [
"vgg = keras.applications.VGG16()\n",
"# SHA-256 of VGG16 weights (with top)\n",
"VGG16_WEIGHTS_SHA256 = '64373286793e3c8b2b4e3219cbf3544bce2f55ab4682710a29f5e7af8f5e4f61'\n",
"\n",
"_weights_path = keras.utils.get_file(\n",
" 'vgg16_weights_tf_dim_ordering_tf_kernels.h5',\n",
" 'https://storage.googleapis.com/tensorflow/keras-applications/vgg16/vgg16_weights_tf_dim_ordering_tf_kernels.h5',\n",
" file_hash=VGG16_WEIGHTS_SHA256,\n",
" hash_algorithm='sha256',\n",
")\n",
"\n",
"vgg = keras.applications.VGG16(weights=_weights_path)\n",
"inp = keras.applications.vgg16.preprocess_input(x_sample[:1])\n",
"\n",
"res = vgg(inp)\n",