在ubuntu系统上用pyinstaller加密打包yolov5项目代码的详细步骤

news2024/9/29 1:24:29

目录

        • 0. 背景
        • 1. 创建虚拟环境
        • 2. pyinstaller打包
          • 2.1. 生成并修改spec文件
          • 2.2. 重新生成二进制文件
        • 3. 测试
        • 4. 加密打包
          • 4.1. 创建入口函数main.py
          • 4.2. 修改detect.py
          • 4.3. 加密生成main.spec文件
          • 4.4. 修改main.spec文件
          • 4.5. 生成二进制文件
          • 4.6. 测试

0. 背景

最近需要在ubuntu 18.04上将自己写的一些基于yolov5的项目代码打包成二进制文件,方便部署的同时也尽量减少暴露源码。

参考网上的很多教程,绝大多数是在win上做的,好像没有在ubuntu 18.04上的详细打包步骤。

1. 创建虚拟环境

这里选用anaconda创建一个干净的Python环境,我这里的python版本为3.8,其他python版本影响应该不大。后面用pyinstaller打包的就是这个环境里面的依赖。

后面的操作会用到一些库,如果执行命令时报错,就自己装库。

首先,下载yolov5-v4.0,这里选择v4.0没有特殊意思,仅仅是我自己用的就是v4.0,其他版本应该也行

git clone https://gitee.com/monkeycc/yolov5.git -b v4.0

其次,创建虚拟环境,这里,需要确认下你的显卡型号、cuda版本是否和pytorch版本适配(可以去Pytorch官网查看),如果不适配后面可能会报错。我这里cuda版本是11.1,我这里选择pytorch 1.10.0

千万不要直接pip install -r requirements.txt,会损坏你其他虚拟环境的torch!

conda create -n pyinstaller python=3.8
conda activate pyinstaller 

pip install torch==1.10.0+cu111 torchvision==0.11.0+cu111 torchaudio==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html
pip install pyyaml numpy opencv-python matplotlib scipy tqdm pandas seaborn -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install pyinstaller -i https://pypi.tuna.tsinghua.edu.cn/simple

cd yolov5

最后,下载weights(链接:https://pan.baidu.com/s/1uVa5eylGETYN0tUB2adjcQ
提取码:ruwf),这里我将yolov5s.pt下载到./yolov5/weights。自己将一张图片test.png放到项目地址./yolov5中,然后执行以下命令测试下,一般是没问题的

python detect.py --source test.png --weights weights/yolov5s.pt

2. pyinstaller打包

pyinstaller命令需要在目标python代码detect.py所在目录./yolov5中执行。这里,我们分为两步,第一步为生成spec文件,第二步为修改spec文件参数,重新生成二进制文件。

2.1. 生成并修改spec文件

执行如下命令

cd yolov5 

pyinstaller -D detect.py

生成的spec文件detect.spec位于目录yolov5中,下一步对detect.spec进行修改,主要是指定外部库、指定外部资源。

这里spec文件参数含义可以参考博客《【python第三方库】pyinstaller使用教程及spec资源文件介绍》以及博客《pyinstaller spec文件详解》,这里我对我们需要修改的参数进行介绍。

  • Analysis里面的scripts参数,如下图
    在这里插入图片描述
    这里的scripts参数为.py文件列表,默认是目标python代码detect.py。由于我这里只需要执行detect.py,所以不需要写多余的python代码。如果除了detect.py外,还想单独执行其他python代码,可以将该python代码加入到列表中。

  • Analysis里面的pathex参数,如下图
    在这里插入图片描述
    这里的pathex参数为文件夹列表,当空的时候,默认为目标python代码detect.py所在的目录./yolov5的绝对地址;这里通常添加自定义库所在目录地址。因为yolov5项目所需要的自定义库utils位于./yolov5中,所以这里pathex参数默认即可。

  • Analysis里面的datas参数,如下图
    在这里插入图片描述
    这里的datas参数为资源目录/资源的列表,当有非python代码之外的其他资源时,如图片/图片目录、数据库/数据库目录、配置/配置目录、权重文件/权重文件目录等,需要在这里写明。比如权重文件yolov5s.pt,存放于./yolov5/weights目录下,这里的根目录为./yolov5;实际二进制文件运行的根目录为./yolov5/dist/detect,因此需要在该根目录下复制weights

  • Analysis里面的hiddenimports参数,如下图
    在这里插入图片描述
    这里的hiddenimports参数为第三方库名称列表。当报错ModuleNotFoundError: No module named 'xxx',即第三方库无法import时,将module名增加到列表中。

最后完整的detect.spec文件如下,

# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(
    ['detect.py'],
    pathex=[],
    binaries=[],
    datas=[('models','./models'), ('weights', './weights'), ('data', './data')],
    hiddenimports=['utils', 'utils.autoanchor'],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    [],
    exclude_binaries=True,
    name='detect',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=True,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
coll = COLLECT(
    exe,
    a.binaries,
    a.zipfiles,
    a.datas,
    strip=False,
    upx=True,
    upx_exclude=[],
    name='detect',
)
2.2. 重新生成二进制文件

修改好detect.spec后,重新生成二进制文件,如下

pyinstaller detect.spec

生成过程中会提示是和删除原有./yolov5/dist/detect目录下的所有文件,直接输入y即可,如下图
在这里插入图片描述
如无意外,很快可以看到成功完成。

生成的二进制文件所在目录为yolov5/dist/detect

3. 测试

这里,退出python环境,然后执行二进制文件,如下

conda deactivate pyinstaller

cd dist/detect

./detect --source ../../test.png --weights weights/yolov5s.pt

这里,测试结果位于yolov5/dist/detect/runs中。

4. 加密打包

加密编译,防止被反编译。

安装pycrypto第三方库。

pip install pycrypto -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install tinyaes -i https://pypi.tuna.tsinghua.edu.cn/simple

加密打包按照如下步骤进行

  • 创建入口函数main.py,该函数将其他python代码(detect.py)作为第三方库进行调用;
  • 修改detect.py,方便入口函数main.py进行调用;
  • 使用命令行pyinstaller -D main.py生成main.spec文件;
  • 修改main.spec文件,重新生成二进制文件
4.1. 创建入口函数main.py

之所以创建入口函数,主要是为了不暴露任何业务代码,将业务代码作为第三方库引入;同时,加密过程主要针对第三方库的业务代码,可以确保业务代码不可反编译。

# coding=utf8

from mydetect import detect
import argparse
import torch


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--weights', nargs='+', type=str, default='yolov5s.pt', help='model.pt path(s)')
    parser.add_argument('--source', type=str, default='data/images', help='source')  # file/folder, 0 for webcam
    parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
    parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold')
    parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS')
    parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
    parser.add_argument('--view-img', action='store_true', help='display results')
    parser.add_argument('--save-txt', action='store_true', help='save results to *.txt')
    parser.add_argument('--save-conf', action='store_true', help='save confidences in --save-txt labels')
    parser.add_argument('--classes', nargs='+', type=int, help='filter by class: --class 0, or --class 0 2 3')
    parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS')
    parser.add_argument('--augment', action='store_true', help='augmented inference')
    parser.add_argument('--update', action='store_true', help='update all models')
    parser.add_argument('--project', default='runs/detect', help='save results to project/name')
    parser.add_argument('--name', default='exp', help='save results to project/name')
    parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
    opt = parser.parse_args()
    print(opt)

    with torch.no_grad():
        weights = opt.weights
        source = opt.source 
        img_size = opt.img_size
        conf_thres = opt.conf_thres
        iou_thres = opt.iou_thres
        device = opt.device
        view_img = opt.view_img
        save_txt = opt.save_txt
        save_conf = opt.save_conf
        classes = opt.classes
        agnostic_nms = opt.agnostic_nms
        augment = opt.augment
        update = opt.update
        project = opt.project
        name = opt.name
        exist_ok = opt.exist_ok
        
        detect(weights, source, img_size, conf_thres, iou_thres, device, view_img, save_txt, save_conf, classes, agnostic_nms, augment, update, project, name, exist_ok)
4.2. 修改detect.py

将detect.py复制为mydetect.py,修改mydetect.py,如下

# coding=utf8
import argparse
import time
from pathlib import Path

import cv2
import torch
import torch.backends.cudnn as cudnn
from numpy import random

from models.experimental import attempt_load
from utils.datasets import LoadStreams, LoadImages
from utils.general import check_img_size, non_max_suppression, apply_classifier, scale_coords, xyxy2xywh, \
    strip_optimizer, set_logging, increment_path
from utils.plots import plot_one_box
from utils.torch_utils import select_device, load_classifier, time_synchronized

# 这里主要将detect()的参数修改下
def detect(weights, source, img_size, conf_thres, iou_thres, device, view_img, save_txt, save_conf, classes, agnostic_nms, augment, update, project, name, exist_ok, save_img=False):
    #source, weights, view_img, save_txt, imgsz = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size
    imgsz = img_size
    webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(
        ('rtsp://', 'rtmp://', 'http://'))

    # Directories
    save_dir = Path(increment_path(Path(project) / name, exist_ok=exist_ok))  # increment run
    (save_dir / 'labels' if save_txt else save_dir).mkdir(parents=True, exist_ok=True)  # make dir

    # Initialize
    set_logging()
    device = select_device(device)
    half = device.type != 'cpu'  # half precision only supported on CUDA

    # Load model
    model = attempt_load(weights, map_location=device)  # load FP32 model
    imgsz = check_img_size(imgsz, s=model.stride.max())  # check img_size
    if half:
        model.half()  # to FP16

    # Second-stage classifier
    classify = False
    if classify:
        modelc = load_classifier(name='resnet101', n=2)  # initialize
        modelc.load_state_dict(torch.load('weights/resnet101.pt', map_location=device)['model']).to(device).eval()

    # Set Dataloader
    vid_path, vid_writer = None, None
    if webcam:
        view_img = True
        cudnn.benchmark = True  # set True to speed up constant image size inference
        dataset = LoadStreams(source, img_size=imgsz)
    else:
        save_img = True
        dataset = LoadImages(source, img_size=imgsz)

    # Get names and colors
    names = model.module.names if hasattr(model, 'module') else model.names
    colors = [[random.randint(0, 255) for _ in range(3)] for _ in names]

    # Run inference
    t0 = time.time()
    img = torch.zeros((1, 3, imgsz, imgsz), device=device)  # init img
    _ = model(img.half() if half else img) if device.type != 'cpu' else None  # run once
    for path, img, im0s, vid_cap in dataset:
        img = torch.from_numpy(img).to(device)
        img = img.half() if half else img.float()  # uint8 to fp16/32
        img /= 255.0  # 0 - 255 to 0.0 - 1.0
        if img.ndimension() == 3:
            img = img.unsqueeze(0)

        # Inference
        t1 = time_synchronized()
        pred = model(img, augment=augment)[0]

        # Apply NMS
        pred = non_max_suppression(pred, conf_thres, iou_thres, classes=classes, agnostic=agnostic_nms)
        t2 = time_synchronized()

        # Apply Classifier
        if classify:
            pred = apply_classifier(pred, modelc, img, im0s)

        # Process detections
        for i, det in enumerate(pred):  # detections per image
            if webcam:  # batch_size >= 1
                p, s, im0, frame = path[i], '%g: ' % i, im0s[i].copy(), dataset.count
            else:
                p, s, im0, frame = path, '', im0s, getattr(dataset, 'frame', 0)

            p = Path(p)  # to Path
            save_path = str(save_dir / p.name)  # img.jpg
            txt_path = str(save_dir / 'labels' / p.stem) + ('' if dataset.mode == 'image' else f'_{frame}')  # img.txt
            s += '%gx%g ' % img.shape[2:]  # print string
            gn = torch.tensor(im0.shape)[[1, 0, 1, 0]]  # normalization gain whwh
            if len(det):
                # Rescale boxes from img_size to im0 size
                det[:, :4] = scale_coords(img.shape[2:], det[:, :4], im0.shape).round()

                # Print results
                for c in det[:, -1].unique():
                    n = (det[:, -1] == c).sum()  # detections per class
                    s += f'{n} {names[int(c)]}s, '  # add to string

                # Write results
                for *xyxy, conf, cls in reversed(det):
                    if save_txt:  # Write to file
                        xywh = (xyxy2xywh(torch.tensor(xyxy).view(1, 4)) / gn).view(-1).tolist()  # normalized xywh
                        line = (cls, *xywh, conf) if opt.save_conf else (cls, *xywh)  # label format
                        with open(txt_path + '.txt', 'a') as f:
                            f.write(('%g ' * len(line)).rstrip() % line + '\n')

                    if save_img or view_img:  # Add bbox to image
                        label = f'{names[int(cls)]} {conf:.2f}'
                        plot_one_box(xyxy, im0, label=label, color=colors[int(cls)], line_thickness=3)

            # Print time (inference + NMS)
            print(f'{s}Done. ({t2 - t1:.3f}s)')

            # Stream results
            if view_img:
                cv2.imshow(str(p), im0)

            # Save results (image with detections)
            if save_img:
                if dataset.mode == 'image':
                    cv2.imwrite(save_path, im0)
                else:  # 'video'
                    if vid_path != save_path:  # new video
                        vid_path = save_path
                        if isinstance(vid_writer, cv2.VideoWriter):
                            vid_writer.release()  # release previous video writer

                        fourcc = 'mp4v'  # output video codec
                        fps = vid_cap.get(cv2.CAP_PROP_FPS)
                        w = int(vid_cap.get(cv2.CAP_PROP_FRAME_WIDTH))
                        h = int(vid_cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
                        vid_writer = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(*fourcc), fps, (w, h))
                    vid_writer.write(im0)

    if save_txt or save_img:
        s = f"\n{len(list(save_dir.glob('labels/*.txt')))} labels saved to {save_dir / 'labels'}" if save_txt else ''
        print(f"Results saved to {save_dir}{s}")

    print(f'Done. ({time.time() - t0:.3f}s)')


if __name__ == '__main__':
    print("运行mydetect.py!")

4.3. 加密生成main.spec文件

注意,pyinstaller命令需要在python环境中运行。

pyinstaller -D  main.py

生成的main.spec文件位于./yolov5目录下。

4.4. 修改main.spec文件

相较于不加密的情况,这里将block_cipher = pyi_crypto.PyiBlockCipher(key='123456'),总体main.spec文件如下

# -*- mode: python ; coding: utf-8 -*-


block_cipher = pyi_crypto.PyiBlockCipher(key='123456')


a = Analysis(
    ['main.py'],
    pathex=[],
    binaries=[],
    datas=[('models','./models'), ('weights', './weights'), ('data', './data')],
    hiddenimports=['utils', 'utils.autoanchor'],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    [],
    exclude_binaries=True,
    name='main',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=True,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
coll = COLLECT(
    exe,
    a.binaries,
    a.zipfiles,
    a.datas,
    strip=False,
    upx=True,
    upx_exclude=[],
    name='detect',
)
4.5. 生成二进制文件
pyinstaller main.spec
4.6. 测试

进入yolov5/dist/main,可以看到

./main --source ../../test.png --weights weights/yolov5s.pt

如果没有问题的话,可以在./yolov5/dist/main/runs中找到推理结果。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/150340.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Payso×OceanBase:云上拓新,开启云数据库的智能托管

日前,聚合支付厂商 Payso( 独角鲨北京科技有限公司)的平台、交易系统引入 OceanBase 原生分布式数据库,实现显著降本增效—— 硬件成本降低 20~30%,查询效率提升 80%,执行效率提升了 30%&#x…

学习IB生物,我们需要知道什么知识点?

学习IB课程的很多同学应该都听说过一个说法:IB生物算是理科中的文科,没有公式推导,只有大量需要记忆的内容,不需要用学习理科的思维去学习,其实这种观点是有误区的。实际上,学习生物这门课将会面对的是一个…

01背包问题详解

目录 1.1二维dp数组 1.2一维dp数组改进 1.3相关例题 1.3.1分割等和子集 1.3.2一和零 1.1二维dp数组 概述:背包的最大重量是固定的,物品的数量,重量也是固定的,并且物品只能放一次,可以选择放或者不放&#xff0c…

Redis 核心原理串讲(中),架构演进之高可用

文章目录Redis 核心原理总览(全局篇)前言一、持久化1、RDB2、AOF3、AOF 重写4、混合持久化5、对比二、副本1、同步模式2、部分重同步三、哨兵1、核心能力2、节点通信总结Redis 核心原理总览(全局篇) 正文开始之前,我们…

【FPGA】Verilog:基本实验步骤演示 | 功能电路创建 | 添加仿真激励 | 观察记录仿真波形

前言: 本章内容主要是演示Vivado下利用Verilog语言进行电路设计、仿真、综合和下载的完整过程、Verilog语言基本运用,电路设计和Test Bench程序的编写、以及实验开发板的使用,通过观察和数据记录理解仿真和FGPA实现的差异。 目录 Ⅰ. 基础知…

考研政治 马原 易混淆知识点

马哲 1. 哲学基本问题 从何者为第一性,分为唯物主义和唯心主义 从是否具有同一性,分为可知论(有同一性)和不可知论(无同一性) 辩证法:联系,发展的观点看世界,认为发展的…

python对接API二次开发高级实战案例解析:百度地图Web服务API封装函数(行政区划区域检索、地理编码、国内天气查询、IP定位、坐标转换)

文章目录前言一、IP定位1.请求URL2.获取IP定位封装函数3.输出结果二、国内天气查询1.请求url2.天气查询封装函数3.输出结果三、行政区划区域检索1.请求url2.区域检索封装函数3.输出结果四、地理编码1.请求url2.地理编码封装函数3.输出结果五、坐标转换1.请求url2.坐标转换封装函…

一文细说Linux虚拟文件系统原理

在 Unix 的世界里,有句很经典的话:一切对象皆是文件。这句话的意思是说,可以将 Unix 操作系统中所有的对象都当成文件,然后使用操作文件的接口来操作它们。Linux 作为一个类 Unix 操作系统,也努力实现这个目标。 虚拟…

CSS 这个就叫优雅 | 多行文本溢出省略

CSS 这个就叫优雅 | 多行文本溢出省略 文章目录CSS 这个就叫优雅 | 多行文本溢出省略一、文本溢出省略方式二、WebKit内核浏览器解决方法🥙三、通用解决方法四、CSS 预处理器封装🥩五、参考资料💘六、推荐博文🍗一、文本溢出省略方…

小样本学习(Few-Shot Learning)训练参数意义

一、常规参数 1.1 epoch 是指所有的训练数据都要跑一遍。假设有6400个样本,在训练过程中,这6400个样本都跑完了才算一个epoch。一般实验需要训练很多个epoch,直到LOSS稳定后才停止。 1.2 batch_size 中文名称是批大小,之前的640…

【数据结构趣味多】二叉树概念及性质

1.树的定义 定义:树(Tree)是n(n>0)个结点的有限集。n0时称为空树。在任意一棵非空树种; 有且仅有一个根结点(root)。当n>1时,其余结点可分为m(m>0&a…

H13-531云计算HCIE V2.0——400~600常错题和知识点总结

400~600 422、在 FusionCloud 6.x 中,以下关于备份的说法哪项是错误的? A.备份协议支持本地,通过 FTP/SFTP 到第三方服务器及 OBS B. 为了保证系统稳定运行,对管理数据进行备份恢复可以确保在异常时对业务的影响降到…

没有完美的项目,也轮不到你,找到适合自己的,先干起来再说

首先明确一点,没有百分百完美的项目,即使有,也轮不到你。不要认为你必须先找到一个完美的项目,然后再去工作。这个想法最后的结局就是项目一直在找,观望,迟迟不行动,不赚钱。如果你真的想找个项…

C++ 语法基础课 习题7 —— 类、结构体、指针、引用

文章目录例题1. 21.斐波那契数列2. 16.替换空格3. 84.123...n4. 28.O(1)时间删除链表结点5. 36.合并两个排序的链表例题 1. 21.斐波那契数列 Acwing 21.斐波那契数列 class Solution { public:int Fibonacci(int n) {if(n < 1) return n;return Fibonacci(n - 1) Fibon…

并发编程 - ThreadLocal

前言 ThreadLocal 用于解决多线程对于共享变量的访问带来的安全性问题。ThreadLocal 存储线程局部变量。每个线程内置 ThreadLocalMap&#xff0c;ThreadLocalMap 的 key 存储 ThreadLocal 实例&#xff0c;value 存储自定义的值。与同步机制相比&#xff0c;它是一种“空间换…

vue性能优化之预渲染prerender-spa-plugin+vue-meta-info解决seo问题

单页面应用中&#xff0c;web项目只有一个页面&#xff0c;前端根据路由不同进行组件之间的对应切换&#xff0c;动态的渲染页面内容。这就是客户端渲染&#xff0c;具有减少服务器端压力、响应速度快等优点。但是单页应用在优化用户体验的同时&#xff0c;也给我们带来了一些对…

阅读 | 001《人工智能导论》(三)知识应用篇1

文章目录知识应用第9章、专家系统9.1 专家系统概述9.2 推理方法9.3 一个简单的专家系统9.4 非确定性推理9.5 专家系统工具9.6 专家系统的应用9.7 专家系统的局限性9.8 本章小结第10章、计算机视觉10.1 计算机视觉概述10.2 数字图像的类型及机内表示10.3 常用计算机视觉模型和关…

计算机重装系统方法教程

​计算机在使用的过程中出现各种问题也是在所难免的&#xff0c;当计算机出现了一些系统故障问题没有办法解决时&#xff0c;或是计算机使用长了以后运行就会变得越来越慢时&#xff0c;这时大家可以考虑通过电脑重装系统来解决&#xff0c;那么&#xff0c;计算机如何重装系统…

ArcGIS基础实验操作100例--实验71多图层叠加查询

本实验专栏参考自汤国安教授《地理信息系统基础实验操作100例》一书 实验平台&#xff1a;ArcGIS 10.6 实验数据&#xff1a;请访问实验1&#xff08;传送门&#xff09; 高级编辑篇--实验71 多图层叠加查询 目录 一、实验背景 二、实验数据 三、实验步骤 &#xff08;1&am…

MATLAB——PCM编译码实验

目录MATLAB——PCM编译码一、实验原理1.掌握PCM编码原理和译码原理2. 练习使用Matlab编程实现PCM编码和译码3. 了解失真度的概念&#xff0c;能对译码结果进行失真度分析二、实验原理三、实验要求1、用Matlab产生一模拟信号&#xff0c;如&#xff1a; 或者自己编写一信号&…