一、 前提:
有Google账号(具体怎么注册账号这里不详述,大家都懂的,自行百度)在你的Google邮箱中关联好colab(怎样在Google邮箱中使用colab在此不详述,自行百度)
二、 现在开始:
因为我们使用的是colab,所以就不必为安装版本对应的anaconda、python以及tensorflow尔苦恼了,经过以下配置就可以直接开始使用了。
在colab中新建代码块,运行以下代码来下载需要的数据集
# In this exercise you will train a CNN on the FULL Cats-v-dogs dataset# This will require you doing a lot of data preprocessing because# the dataset isn't split into training and validation for you# This code block has all the required inputsimport osimport zipfileimport randomimport tensorflow as tffrom tensorflow.keras.optimizers import RMSpropfrom tensorflow.keras.preprocessing.image import ImageDataGeneratorfrom shutil import copyfile# This code block downloads the full Cats-v-Dogs dataset and stores it as # cats-and-dogs.zip. It then unzips it to /tmp# which will create a tmp/PetImages directory containing subdirectories# called 'Cat' and 'Dog' (that's how the original researchers structured it)# If the URL doesn't work, # . visit https:///ADlead/Dogs-Cats.git到此这篇关于使用tensorflow框架在Colab上跑通猫狗识别代码的文章就介绍到这了,更多相关tensorflow框架在Colab上跑通猫狗识别内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!