waterman 发表于 2024-11-27 19:32

【读书】《计算机视觉之PyTorch数字图像处理》2.Pytorch环境搭建

<p>我们先跳过第一章的计算机视觉与数字图像概述,直接从环境搭建这一节章开始学习。</p>

<p>在这一章中主要介绍了从零开始搭建Pytorch开发环境,包括:</p>

<ol start="1">
        <li data-list="number">
        <p>介绍python的下载和安装,并介绍了如何运行Python程序。</p>
        </li>
        <li data-list="number">
        <p>介绍CUDA的用途,并介绍CUDA的下载和安装。</p>
        </li>
        <li data-list="number">
        <p>介绍Python第三方库的作用,并介绍Python第三方库的安装方法</p>
        </li>
        <li data-list="number">
        <p>介绍如何正确选择Pytorch的版本,以及Pytorch的安装方法。</p>
        </li>
        <li data-list="number">
        <p>最后还介绍了可视化工具Visdom和集成开发环境Spyder的安装和使用。</p>
        </li>
</ol>

<p>&nbsp;</p>

<p>文中对于Python、CUDA的背景和发展历程介绍的很详细,使我又增加了许多新的知识。并且对于python的安装基本上说是手把手,按照书中的步骤来基本上是没有问题的。</p>

<p>&nbsp;</p>

<p>此外,pip是python的一个第三方库,也是python内置的第三方库管理和维护工具,大部分python的第三方库都能够使用命令pip install xxx进行安装,xxx表示需要安装的第三方库名。以下是相关常用命令:</p>

<ol start="1">
        <li data-list="number">
        <p>安装库:pip install xxx</p>
        </li>
        <li data-list="number">
        <p>升级库:pip install --upgrade xxx</p>
        </li>
        <li data-list="number">
        <p>查看已安装的库:pip list</p>
        </li>
        <li data-list="number">
        <p>查看库信息:pip show xxx</p>
        </li>
        <li data-list="number">
        <p>卸载库:pip uninstall xxx</p>
        </li>
        <li data-list="number">
        <p>下载指定库到当前目录:pip download xxx</p>
        </li>
</ol>

<p>&nbsp;</p>

<p>此外在第三方库的安装中,作者还详细列举了与图像处理相关的库如下表所示:</p>

<p><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css"><!--br {mso-data-placement:same-cell;}--> td {white-space:nowrap;border:1px solid #dee0e3;font-size:10pt;font-style:normal;font-weight:normal;vertical-align:middle;word-break:normal;word-wrap:normal;}
</style>
</p>

<table>
        <colgroup>
                <col width="105" />
                <col width="105" />
                <col width="105" />
        </colgroup>
        <tbody>
                <tr height="27">
                        <td>第三方库名</td>
                        <td>功能简介</td>
                        <td>官方网址及其文档</td>
                </tr>
                <tr height="42">
                        <td>gdal</td>
                        <td>支持最广泛图像(栅格)格式,主要用于图像的存取和图像文件格式的转换。</td>
                        <td _blank="" data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;&lt;a target=">https://gdal.org/&quot;,&quot;text&quot;:&quot;<a href="https://gdal.org/&quot;" target="_blank">https://gdal.org/&quot;</a>}]&quot;&gt;<a href="https://gdal.org/">https://gdal.org/</a></td>
                </tr>
                <tr height="53">
                        <td>pillow</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;之前称&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;PIL&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;库,是最常用的图像处理库,提供了常用图像格式的读取以及较丰富的图像处理功能。&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}}]">之前称PIL库,是最常用的图像处理库,提供了常用图像格式的读取以及较丰富的图像处理功能。</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;https://pillow-cn.readthedocs.io/&quot;,&quot;text&quot;:&quot;https://pillow-cn.readthedocs.io&quot;}]"><a href="https://pillow-cn.readthedocs.io/">https://pillow-cn.readthedocs.io</a></td>
                </tr>
                <tr height="53">
                        <td>opencv-python</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;opencv&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;的&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;python&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;接口,提供了对&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;opencv&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;的完全支持,拥有强大的图像处理功能。&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}}]">opencv的python接口,提供了对opencv的完全支持,拥有强大的图像处理功能。</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;https://github.com/skvark/opencv-python&quot;,&quot;text&quot;:&quot;https://github.com/skvark/opencv-python&quot;}]"><a href="https://github.com/skvark/opencv-python">https://github.com/skvark/opencv-python</a></td>
                </tr>
                <tr height="31">
                        <td>simplecv</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;在易用性上较&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;opencv&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;好,功能与&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;opencv&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;类似。&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}}]">在易用性上较opencv好,功能与opencv类似。</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;http://simplecv.org/&quot;,&quot;text&quot;:&quot;http://simplecv.org/&quot;}]"><a href="http://simplecv.org/">http://simplecv.org/</a></td>
                </tr>
                <tr height="42">
                        <td>numpy</td>
                        <td>提供强大的数组计算功能,可用于图像处理,提供灵活的自定义图像处理方法。</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;https://numpy.org/&quot;,&quot;text&quot;:&quot;https://numpy.org/&quot;}]"><a href="https://numpy.org/">https://numpy.org/</a></td>
                </tr>
                <tr height="53">
                        <td>scipy</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;在&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;numpy&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;库的基础上,提供更高级的科学计算功能,提供了一些图像处理的方法。&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}}]">在numpy库的基础上,提供更高级的科学计算功能,提供了一些图像处理的方法。</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;https://scipy.org/&quot;,&quot;text&quot;:&quot;https://scipy.org&quot;}]"><a href="https://scipy.org/">https://scipy.org</a></td>
                </tr>
                <tr height="53">
                        <td>matplotlib</td>
                        <td>基于本地的数据的可视化工具,提供了丰富的数组可视化效果,并提供了方便的图像显示功能。</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;https://matplotlib.org/&quot;,&quot;text&quot;:&quot;https://matplotlib.org/&quot;}]"><a href="https://matplotlib.org/">https://matplotlib.org/</a></td>
                </tr>
                <tr height="42">
                        <td>visdom</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;基于&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;web&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;的数据的可视化工具,能够灵活的嵌入需要可视化的代码中。&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}}]">基于web的数据的可视化工具,能够灵活的嵌入需要可视化的代码中。</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;https://github.com/facebookresearch/visdom&quot;,&quot;text&quot;:&quot;https://github.com/facebookresearch/visdom&quot;}]"><a href="https://github.com/facebookresearch/visdom">https://github.com/facebookresearch/visdom</a></td>
                </tr>
                <tr height="53">
                        <td>tensorflow</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;google&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;公司开发的具有梯度反传的张量计算模型,是构建深度学习模型的主要框架之一。&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}}]">google公司开发的具有梯度反传的张量计算模型,是构建深度学习模型的主要框架之一。</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;https://tensorflow.google.cn/&quot;,&quot;text&quot;:&quot;https://tensorflow.google.cn/&quot;}]"><a href="https://tensorflow.google.cn/">https://tensorflow.google.cn/</a></td>
                </tr>
                <tr height="65">
                        <td>torchvision</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;与&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;PyTorch&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;进行协同的库,提供主要用于提供图像预处理方法,图像与张量的转换,以及常用的图像处理预训练模型&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}}]">与PyTorch进行协同的库,提供主要用于提供图像预处理方法,图像与张量的转换,以及常用的图像处理预训练模型</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;https://github.com/pytorch/vision&quot;,&quot;text&quot;:&quot;https://github.com/pytorch/vision&quot;}]"><a href="https://github.com/pytorch/vision">https://github.com/pytorch/vision</a></td>
                </tr>
                <tr height="53">
                        <td>PyTorch</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;Facebook&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}},{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;公司开发的具有梯度反传的张量计算库,是构建深度学习模型的主要框架之一。&quot;,&quot;style&quot;:{&quot;font&quot;:&quot;6pt/1.5 MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, \&quot;Helvetica Neue\&quot;, Tahoma, \&quot;PingFang SC\&quot;, \&quot;Microsoft Yahei\&quot;, Arial, \&quot;Hiragino Sans GB\&quot;, sans-serif, \&quot;Apple Color Emoji\&quot;, \&quot;Segoe UI Emoji\&quot;, \&quot;Segoe UI Symbol\&quot;, \&quot;Noto Color Emoji\&quot;&quot;,&quot;foreColor&quot;:&quot;rgb(0, 0, 0)&quot;}}]">Facebook公司开发的具有梯度反传的张量计算库,是构建深度学习模型的主要框架之一。</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;https://pytorch.org/&quot;,&quot;text&quot;:&quot;https://pytorch.org/&quot;}]"><a href="https://pytorch.org/">https://pytorch.org/</a></td>
                </tr>
                <tr height="53">
                        <td>paddlepaddle</td>
                        <td>百度公司开发的具有梯度反传的张量计算库,是构建深度学习模型的主要框架之一。</td>
                        <td data-sheet-value="[{&quot;type&quot;:&quot;url&quot;,&quot;link&quot;:&quot;https://www.paddlepaddle.org.cn/&quot;,&quot;text&quot;:&quot;https://www.paddlepaddle.org.cn/&quot;}]"><a href="https://www.paddlepaddle.org.cn/">https://www.paddlepaddle.org.cn/</a></td>
                </tr>
        </tbody>
</table>

<p>其中matplotlib和visdom都是数据可视化工具,平时听说matplotlib好像更多一些,好奇作者为什么在后文中只介绍了visdom而没介绍matplotlib。</p>

<p>&nbsp;</p>

<p>书中共介绍了两种版本Pytorch的安装,一种是CUDA版本,一种是CPU版本。在安装CUDA版本的pytorch之前,需要拥有一个英伟达的显卡,并且完成对应版本CUDA的安装。若不需要使用GPU或者本地没有GPU,则直接安装CPU版本的就好啦。不同版本的Pytorch安装命令可以直接在官网上查看。</p>

<div style="text-align: center;"></div>

<p>从官网上可以看到Pytorch现在也支持AMD的显卡驱动了,但是目前仅提供Linux环境下的安装,还不支持Windows环境。</p>

<div style="text-align: center;"></div>

<p>&nbsp;</p>

<p>安装完成后可以在python环境中输入如下命令,用于测试是否安装成功</p>

<pre>
<code class="language-python">import torch</code></pre>

<pre>

如果如下图没有报错,就说明我们安装成功了</pre>

<div style="text-align: center;"></div>

<p>接下来就能够进行python和pytorch的编程了。</p>
页: [1]
查看完整版本: 【读书】《计算机视觉之PyTorch数字图像处理》2.Pytorch环境搭建