{"id":105111,"date":"2026-09-13T20:57:09","date_gmt":"2026-09-13T12:57:09","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/105111.html"},"modified":"2026-09-13T20:57:09","modified_gmt":"2026-09-13T12:57:09","slug":"%e5%88%9d%e8%af%86%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0-%e6%95%b0%e6%8d%ae%e5%a2%9e%e5%bc%ba%e4%b8%8e%e6%a8%a1%e5%9e%8b%e4%bf%9d%e5%ad%98","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/105111.html","title":{"rendered":"\u521d\u8bc6\u6df1\u5ea6\u5b66\u4e60\u2014\u2014\u6570\u636e\u589e\u5f3a\u4e0e\u6a21\u578b\u4fdd\u5b58"},"content":{"rendered":"<h3>\u4e00\u3001\u5f15\u8a00&#xff1a;\u8ba9\u6a21\u578b\u957f\u89c1\u8bc6&#xff0c;\u8ba9\u6210\u679c\u7559\u4e0b\u6765<\/h3>\n<p>\u5728\u524d\u4e24\u7bc7\u535a\u5ba2\u4e2d&#xff0c;\u6211\u4eec\u5b8c\u6210\u4e86\u4ece\u81ea\u5b9a\u4e49\u6570\u636e\u96c6\u5230CNN\u6a21\u578b\u8bad\u7ec3\u7684\u5b8c\u6574\u6d41\u7a0b\u3002\u4f46\u5982\u679c\u4f60\u4ed4\u7ec6\u56de\u987e&#xff0c;\u4f1a\u53d1\u73b0\u4e00\u4e2a\u6f5c\u5728\u7684\u95ee\u9898&#xff1a;\u8bad\u7ec3\u6570\u636e\u592a\u5355\u4e00\u3002<\/p>\n<p>\u6a21\u578b\u53ea\u89c1\u8fc7\u6b63\u7740\u6446\u653e\u7684\u3001\u4eae\u5ea6\u56fa\u5b9a\u7684\u3001\u540c\u4e00\u89d2\u5ea6\u7684\u7269\u54c1\u3002\u4e00\u65e6\u6d4b\u8bd5\u56fe\u7247\u7a0d\u6709\u65cb\u8f6c\u3001\u7ffb\u8f6c\u6216\u989c\u8272\u53d8\u5316&#xff0c;\u6a21\u578b\u5c31\u53ef\u80fd\u50bb\u773c\u2014\u2014\u8fd9\u5c31\u662f\u6240\u8c13\u7684\u8fc7\u62df\u5408\u3002<\/p>\n<p>\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u5229\u5668&#xff0c;\u5c31\u662f\u6570\u636e\u589e\u5f3a&#xff08;Data Augmentation&#xff09;\u3002\u5b83\u901a\u8fc7\u5bf9\u8bad\u7ec3\u56fe\u7247\u8fdb\u884c\u968f\u673a\u53d8\u6362&#xff08;\u65cb\u8f6c\u3001\u7ffb\u8f6c\u3001\u8c03\u8272\u7b49&#xff09;&#xff0c;\u4eba\u4e3a\u5730\u5236\u9020\u51fa\u66f4\u591a\u6837\u5316\u7684\u8bad\u7ec3\u6837\u672c&#xff0c;\u8ba9\u6a21\u578b\u5b66\u4f1a\u5ffd\u7565\u8fd9\u4e9b\u65e0\u5173\u53d8\u5316&#xff0c;\u4e13\u6ce8\u4e8e\u771f\u6b63\u7684\u7c7b\u522b\u7279\u5f81\u3002<\/p>\n<p>\u4e0e\u6b64\u540c\u65f6&#xff0c;\u8bad\u7ec3\u4e86\u82e5\u5e72\u8f6e\u4e4b\u540e&#xff0c;\u6211\u4eec\u5f97\u5230\u4e86\u4e00\u4e2a\u4e0d\u9519\u7684\u6a21\u578b\u2014\u2014\u4f46\u5982\u679c\u6ca1\u6709\u4fdd\u5b58&#xff0c;\u4e0b\u6b21\u5c31\u5f97\u4ece\u5934\u518d\u6765\u3002\u6a21\u578b\u4fdd\u5b58\u8ba9\u8bad\u7ec3\u6210\u679c\u5f97\u4ee5\u6301\u4e45\u5316&#xff0c;\u968f\u65f6\u53ef\u4ee5\u52a0\u8f7d\u4f7f\u7528\u3002<\/p>\n<p>\u672c\u7bc7\u535a\u5ba2\u5c06\u56f4\u7ed5\u8fd9\u4e24\u5927\u4e3b\u9898\u5c55\u5f00&#xff0c;\u57fa\u4e8e\u5b8c\u6574\u4ee3\u7801\u8bb2\u89e3\u6570\u636e\u589e\u5f3a\u3001\u6807\u51c6\u5316\u3001\u6700\u4f18\u6a21\u578b\u4fdd\u5b58\u4e09\u5927\u6838\u5fc3\u77e5\u8bc6\u70b9\u3002<\/p>\n<h3>\u4e8c\u3001\u6570\u636e\u589e\u5f3a<\/h3>\n<h4>2.1 \u8bad\u7ec3\u96c6 vs \u9a8c\u8bc1\u96c6&#xff1a;\u4e24\u5957\u4e0d\u540c\u7684\u53d8\u6362\u7b56\u7565<\/h4>\n<p>\u4ee3\u7801\u4e2d\u6700\u9192\u76ee\u7684\u8bbe\u8ba1&#xff0c;\u662f\u5b9a\u4e49\u4e86\u4e24\u5957\u53d8\u6362\u6d41\u7a0b&#xff1a;<\/p>\n<p>data_transforms &#061; {<br \/>\n    &#039;trainda&#039;: transforms.Compose([<br \/>\n        transforms.RandomRotation(45),<br \/>\n        transforms.CenterCrop(256),<br \/>\n        transforms.RandomHorizontalFlip(p&#061;0.5),<br \/>\n        transforms.RandomVerticalFlip(p&#061;0.5),<br \/>\n        transforms.ColorJitter(brightness&#061;0.2, contrast&#061;0.1, saturation&#061;0.1, hue&#061;0.1),<br \/>\n        transforms.RandomGrayscale(p&#061;0.1),<br \/>\n        transforms.ToTensor(),<br \/>\n        transforms.Normalize(mean&#061;[0.485, 0.456, 0.406], std&#061;[0.229, 0.224, 0.225])<br \/>\n    ]),<br \/>\n    &#039;valid&#039;: transforms.Compose([<br \/>\n        transforms.Resize([256, 256]),<br \/>\n        transforms.ToTensor(),<br \/>\n        transforms.Normalize(mean&#061;[0.485, 0.456, 0.406], std&#061;[0.229, 0.224, 0.225])<br \/>\n    ]),<br \/>\n}<\/p>\n<p>\u6838\u5fc3\u539f\u5219&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u8bad\u7ec3\u96c6&#xff1a;\u4f7f\u7528\u968f\u673a\u53d8\u6362&#xff08;\u6570\u636e\u589e\u5f3a&#xff09;&#xff0c;\u8ba9\u6bcf\u4e2aepoch\u770b\u5230\u7684\u56fe\u7247\u90fd\u7565\u6709\u4e0d\u540c&#xff0c;\u63d0\u5347\u6cdb\u5316\u80fd\u529b\u3002<\/p>\n<\/li>\n<li>\n<p>\u9a8c\u8bc1\u96c6\/\u6d4b\u8bd5\u96c6&#xff1a;\u53ea\u505a\u5fc5\u8981\u7684\u5c3a\u5bf8\u7edf\u4e00\u548c\u6807\u51c6\u5316&#xff0c;\u4e0d\u80fd\u52a0\u5165\u968f\u673a\u6027&#xff0c;\u5426\u5219\u8bc4\u4f30\u7ed3\u679c\u4e0d\u7a33\u5b9a\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>2.2 \u5e38\u7528\u6570\u636e\u589e\u5f3a\u65b9\u6cd5\u8be6\u89e3<\/h4>\n<h5>&#xff08;1&#xff09;RandomRotation\u2014\u2014\u968f\u673a\u65cb\u8f6c<\/h5>\n<p>transforms.RandomRotation(45)<\/p>\n<p>\u5728 -45\u00b0\u523045\u00b0 \u4e4b\u95f4\u968f\u673a\u65cb\u8f6c\u56fe\u7247\u3002\u8fd9\u6a21\u62df\u4e86\u62cd\u6444\u89d2\u5ea6\u4e0d\u540c\u7684\u60c5\u51b5&#xff0c;\u8ba9\u6a21\u578b\u5b66\u4f1a\u8bc6\u522b\u65cb\u8f6c\u540e\u7684\u7269\u4f53\u3002<\/p>\n<h5>&#xff08;2&#xff09;CenterCrop\u2014\u2014\u4e2d\u5fc3\u88c1\u526a<\/h5>\n<p>transforms.CenterCrop(256)<\/p>\n<p>\u4ece\u56fe\u50cf\u4e2d\u5fc3\u88c1\u526a\u51fa256\u00d7256\u7684\u533a\u57df\u3002\u914d\u5408RandomRotation\u4f7f\u7528&#xff0c;\u53ef\u4ee5\u88c1\u6389\u65cb\u8f6c\u540e\u4ea7\u751f\u7684\u9ed1\u8fb9&#xff0c;\u4fdd\u8bc1\u8f93\u5165\u5c3a\u5bf8\u4e00\u81f4\u3002<\/p>\n<h5>&#xff08;3&#xff09;RandomHorizontalFlip \/ RandomVerticalFlip\u2014\u2014\u968f\u673a\u7ffb\u8f6c<\/h5>\n<p>transforms.RandomHorizontalFlip(p&#061;0.5)  # \u6c34\u5e73\u7ffb\u8f6c&#xff0c;50%\u6982\u7387<br \/>\ntransforms.RandomVerticalFlip(p&#061;0.5)    # \u5782\u76f4\u7ffb\u8f6c&#xff0c;50%\u6982\u7387<\/p>\n<p>\u4ee5\u6307\u5b9a\u6982\u7387\u5bf9\u56fe\u7247\u8fdb\u884c\u7ffb\u8f6c\u3002\u6c34\u5e73\u7ffb\u8f6c\u9002\u5408\u5927\u591a\u6570\u573a\u666f&#xff08;\u5982\u52a8\u7269\u3001\u8f66\u8f86&#xff09;&#xff0c;\u5782\u76f4\u7ffb\u8f6c\u5219\u8981\u8c28\u614e\u4f7f\u7528&#xff08;\u5bf9\u4e8e\u4eba\u8138\u7b49\u6709\u65b9\u5411\u6027\u7684\u7269\u4f53\u53ef\u80fd\u4e0d\u5408\u9002&#xff09;\u3002<\/p>\n<h5>&#xff08;4&#xff09;ColorJitter\u2014\u2014\u989c\u8272\u6296\u52a8<\/h5>\n<p>transforms.ColorJitter(brightness&#061;0.2, contrast&#061;0.1, saturation&#061;0.1, hue&#061;0.1)<\/p>\n<p>\u968f\u673a\u8c03\u6574\u56fe\u50cf\u7684\u4eae\u5ea6\u3001\u5bf9\u6bd4\u5ea6\u3001\u9971\u548c\u5ea6\u3001\u8272\u76f8\u3002\u8fd9\u6a21\u62df\u4e86\u4e0d\u540c\u5149\u7167\u6761\u4ef6\u4e0b\u7684\u62cd\u6444\u6548\u679c&#xff0c;\u63d0\u5347\u6a21\u578b\u5bf9\u5149\u7167\u53d8\u5316\u7684\u9c81\u68d2\u6027\u3002<\/p>\n<table>\n<tr>\u53c2\u6570\u542b\u4e49\u53d6\u503c\u8303\u56f4<\/tr>\n<tbody>\n<tr>\n<td>brightness<\/td>\n<td>\u4eae\u5ea6<\/td>\n<td>0.2\u8868\u793a\u5728[0.8, 1.2]\u500d\u4e4b\u95f4\u968f\u673a\u8c03\u6574<\/td>\n<\/tr>\n<tr>\n<td>contrast<\/td>\n<td>\u5bf9\u6bd4\u5ea6<\/td>\n<td>\u540c\u4e0a<\/td>\n<\/tr>\n<tr>\n<td>saturation<\/td>\n<td>\u9971\u548c\u5ea6<\/td>\n<td>\u540c\u4e0a<\/td>\n<\/tr>\n<tr>\n<td>hue<\/td>\n<td>\u8272\u76f8<\/td>\n<td>0.1\u8868\u793a\u5728[-0.1, 0.1]\u4e4b\u95f4\u504f\u79fb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>&#xff08;5&#xff09;RandomGrayscale\u2014\u2014\u968f\u673a\u7070\u5ea6\u5316<\/h5>\n<p>transforms.RandomGrayscale(p&#061;0.1)<\/p>\n<p>\u4ee510%\u7684\u6982\u7387\u5c06\u5f69\u8272\u56fe\u7247\u8f6c\u4e3a\u7070\u5ea6\u56fe&#xff08;R&#061;G&#061;B&#xff09;\u3002\u8fd9\u5f3a\u5236\u6a21\u578b\u4e0d\u4f9d\u8d56\u989c\u8272\u4fe1\u606f&#xff0c;\u5b66\u4e60\u66f4\u672c\u8d28\u7684\u5f62\u72b6\u7279\u5f81\u3002<\/p>\n<h4>2.3 ToTensor \u4e0e Normalize\u2014\u2014\u6807\u51c6\u5316\u7684\u4e24\u6b65<\/h4>\n<h5>ToTensor&#xff1a;\u4ecePIL\u5230\u5f20\u91cf<\/h5>\n<p>transforms.ToTensor()<\/p>\n<p>\u4f5c\u7528&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5c06PIL\u56fe\u50cf\u6216NumPy\u6570\u7ec4\u8f6c\u4e3aPyTorch\u5f20\u91cf<\/p>\n<\/li>\n<li>\n<p>\u5c06\u50cf\u7d20\u503c\u4ece 0-255 \u7f29\u653e\u5230 0-1<\/p>\n<\/li>\n<li>\n<p>\u5c06\u901a\u9053\u7ef4\u5ea6\u4ece HWC \u8f6c\u4e3a CHW&#xff08;PyTorch\u8981\u6c42&#xff09;<\/p>\n<\/li>\n<\/ul>\n<h5>Normalize&#xff1a;\u6807\u51c6\u5316\u5230\u6807\u51c6\u6b63\u6001\u5206\u5e03<\/h5>\n<p>transforms.Normalize(mean&#061;[0.485, 0.456, 0.406], std&#061;[0.229, 0.224, 0.225])<\/p>\n<p>\u8ba1\u7b97\u65b9\u5f0f&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"x_{normalize} = \\\\frac{x - mean}{std}\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260913125708-6aa69da4d3b53.png\" \/><\/p>\n<p>\u4e3a\u4ec0\u4e48\u7528\u8fd9\u7ec4\u7279\u5b9a\u7684\u5747\u503c\u548c\u6807\u51c6\u5dee&#xff1f; \u5b83\u4eec\u662f ImageNet\u6570\u636e\u96c6\u4e0a\u7edf\u8ba1\u51fa\u6765\u7684RGB\u4e09\u901a\u9053\u5747\u503c\u548c\u6807\u51c6\u5dee\u3002\u7531\u4e8e\u5927\u591a\u6570\u9884\u8bad\u7ec3\u6a21\u578b\u90fd\u662f\u5728ImageNet\u4e0a\u8bad\u7ec3\u7684&#xff0c;\u4f7f\u7528\u76f8\u540c\u7684\u6807\u51c6\u5316\u53c2\u6570\u53ef\u4ee5\u4fdd\u6301\u6570\u636e\u5206\u5e03\u4e00\u81f4\u3002<\/p>\n<p>\u6807\u51c6\u5316\u7684\u610f\u4e49&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u8ba9\u6570\u636e\u5206\u5e03\u63a5\u8fd1\u6807\u51c6\u6b63\u6001\u5206\u5e03&#xff0c;\u52a0\u901f\u68af\u5ea6\u4e0b\u964d\u6536\u655b<\/p>\n<\/li>\n<li>\n<p>\u6d88\u9664\u4e0d\u540c\u901a\u9053\u4e4b\u95f4\u7684\u91cf\u7eb2\u5dee\u5f02<\/p>\n<\/li>\n<li>\n<p>\u662f\u8fc1\u79fb\u5b66\u4e60\u4e2d\u4f7f\u7528\u9884\u8bad\u7ec3\u6a21\u578b\u65f6\u7684\u5fc5\u8981\u6b65\u9aa4<\/p>\n<\/li>\n<\/ul>\n<h3>\u4e09\u3001\u81ea\u5b9a\u4e49\u6570\u636e\u96c6\u56de\u987e<\/h3>\n<p>\u6570\u636e\u96c6\u7c7b\u4e0e\u4e0a\u4e00\u7bc7\u535a\u5ba2\u4e00\u81f4&#xff1a;<\/p>\n<p>class food_dataset(Dataset):<br \/>\n    def __init__(self, file_path, transform&#061;None):<br \/>\n        self.file_path &#061; file_path<br \/>\n        self.imgs &#061; []<br \/>\n        self.labels &#061; []<br \/>\n        self.transform &#061; transform<br \/>\n        with open(self.file_path) as f:<br \/>\n            samples &#061; [x.strip().split(&#039; &#039;) for x in f.readlines()]<br \/>\n            for img_path, label in samples:<br \/>\n                self.imgs.append(img_path)<br \/>\n                self.labels.append(label)<\/p>\n<p>    def __len__(self):<br \/>\n        return len(self.imgs)<\/p>\n<p>    def __getitem__(self, idx):<br \/>\n        image &#061; Image.open(self.imgs[idx])<br \/>\n        if self.transform:<br \/>\n            image &#061; self.transform(image)<br \/>\n        label &#061; torch.from_numpy(np.array(self.labels[idx], dtype&#061;np.int64))<br \/>\n        return image, label<\/p>\n<p>\u7136\u540e\u5206\u522b\u7528\u8bad\u7ec3\u53d8\u6362\u548c\u9a8c\u8bc1\u53d8\u6362\u521b\u5efa\u6570\u636e\u96c6&#xff1a;<\/p>\n<p>training_data &#061; food_dataset(file_path&#061;&#039;.\/train.txt&#039;, transform&#061;data_transforms[&#039;trainda&#039;])<br \/>\ntest_data &#061; food_dataset(file_path&#061;&#039;.\/test.txt&#039;, transform&#061;data_transforms[&#039;valid&#039;])<\/p>\n<p>train_dataloader &#061; DataLoader(training_data, batch_size&#061;64, shuffle&#061;True)<br \/>\ntest_dataloader &#061; DataLoader(test_data, batch_size&#061;64, shuffle&#061;True)<\/p>\n<h3>\u56db\u3001CNN\u6a21\u578b\u7ed3\u6784<\/h3>\n<p>\u6a21\u578b\u4e0e\u4e0a\u4e00\u7bc7\u76f8\u540c&#xff0c;\u9488\u5bf9 3\u00d7256\u00d7256 \u5f69\u8272\u8f93\u5165&#xff0c;\u8f93\u51fa20\u4e2a\u7c7b\u522b&#xff1a;<\/p>\n<p>class CNN(nn.Module):<br \/>\n    def __init__(self):<br \/>\n        super(CNN, self).__init__()<br \/>\n        self.conv1 &#061; nn.Sequential(<br \/>\n            nn.Conv2d(3, 16, 5, 1, 2),<br \/>\n            nn.ReLU(),<br \/>\n            nn.MaxPool2d(2),<br \/>\n        )<br \/>\n        self.conv2 &#061; nn.Sequential(<br \/>\n            nn.Conv2d(16, 32, 5, 1, 2),<br \/>\n            nn.ReLU(),<br \/>\n            nn.Conv2d(32, 64, 5, 1, 2),<br \/>\n            nn.ReLU(),<br \/>\n            nn.MaxPool2d(2),<br \/>\n        )<br \/>\n        self.conv3 &#061; nn.Sequential(<br \/>\n            nn.Conv2d(64, 128, 5, 1, 2),<br \/>\n            nn.ReLU(),<br \/>\n        )<br \/>\n        self.out &#061; nn.Linear(128*64*64, 20)<\/p>\n<p>    def forward(self, x):<br \/>\n        x &#061; self.conv1(x)<br \/>\n        x &#061; self.conv2(x)<br \/>\n        x &#061; self.conv3(x)<br \/>\n        x &#061; x.view(x.size(0), -1)<br \/>\n        output &#061; self.out(x)<br \/>\n        return output<\/p>\n<p>\u5c3a\u5bf8\u53d8\u5316&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u8f93\u5165&#xff1a;3\u00d7256\u00d7256<\/p>\n<\/li>\n<li>\n<p>conv1\u540e&#xff1a;16\u00d7128\u00d7128<\/p>\n<\/li>\n<li>\n<p>conv2\u540e&#xff1a;64\u00d764\u00d764<\/p>\n<\/li>\n<li>\n<p>conv3\u540e&#xff1a;128\u00d764\u00d764<\/p>\n<\/li>\n<li>\n<p>\u5c55\u5e73&#xff1a;128\u00d764\u00d764 &#061; 524288 \u7ef4<\/p>\n<\/li>\n<li>\n<p>\u8f93\u51fa&#xff1a;20\u7c7b<\/p>\n<\/li>\n<\/ul>\n<h3>\u4e94\u3001\u8bad\u7ec3\u51fd\u6570<\/h3>\n<p>def train(dataloader, model, loss_fn, optimizer):<br \/>\n    model.train()<br \/>\n    batch_size_num &#061; 1<br \/>\n    for x, y in dataloader:<br \/>\n        x, y &#061; x.to(device), y.to(device)<br \/>\n        pred &#061; model.forward(x)<br \/>\n        loss &#061; loss_fn(pred, y)<br \/>\n        optimizer.zero_grad()<br \/>\n        loss.backward()<br \/>\n        optimizer.step()<br \/>\n        loss_value &#061; loss.item()<br \/>\n        if batch_size_num % 1 &#061;&#061; 0:<br \/>\n            print(f&#034;loss:{loss_value:7f} [number:{batch_size_num}]&#034;)<br \/>\n        batch_size_num &#043;&#061; 1<\/p>\n<p>\u8bad\u7ec3\u8fc7\u7a0b\u4e0e\u4e4b\u524d\u4e00\u81f4&#xff1a;\u524d\u5411\u4f20\u64ad\u2192\u8ba1\u7b97\u635f\u5931\u2192\u68af\u5ea6\u6e05\u96f6\u2192\u53cd\u5411\u4f20\u64ad\u2192\u66f4\u65b0\u53c2\u6570\u3002<\/p>\n<h3>\u516d\u3001\u6a21\u578b\u4fdd\u5b58<\/h3>\n<p>\u8fd9\u662f\u672c\u7bc7\u535a\u5ba2\u7684\u91cd\u70b9\u3002\u6d4b\u8bd5\u51fd\u6570\u4e2d&#xff0c;\u5f53\u6a21\u578b\u51c6\u786e\u7387\u521b\u65b0\u9ad8\u65f6&#xff0c;\u4f1a\u4fdd\u5b58\u6a21\u578b&#xff1a;<\/p>\n<p>best_acc &#061; 0<\/p>\n<p>def test(dataloader, model, loss_fn):<br \/>\n    global best_acc<br \/>\n    size &#061; len(dataloader.dataset)<br \/>\n    num_batches &#061; len(dataloader)<br \/>\n    model.eval()<br \/>\n    test_loss, correct &#061; 0, 0<br \/>\n    with torch.no_grad():<br \/>\n        for X, y in dataloader:<br \/>\n            X, y &#061; X.to(device), y.to(device)<br \/>\n            pred &#061; model.forward(X)<br \/>\n            test_loss &#043;&#061; loss_fn(pred, y).item()<br \/>\n            correct &#043;&#061; (pred.argmax(1) &#061;&#061; y).type(torch.float).sum().item()<br \/>\n    test_loss \/&#061; num_batches<br \/>\n    correct \/&#061; size<br \/>\n    print(f&#034;Test result: \\\\n Accuracy: {(100*correct)}%, Avg loss: {test_loss}&#034;)<\/p>\n<p>    # \u4fdd\u5b58\u6700\u4f18\u6a21\u578b<br \/>\n    if correct &gt; best_acc:<br \/>\n        best_acc &#061; correct<br \/>\n        print(model.state_dict().keys())<br \/>\n        torch.save(model.state_dict(), f&#034;xxxxxx.pth&#034;)<br \/>\n        script_model &#061; torch.jit.script(model)<br \/>\n        torch.jit.save(script_model, f&#034;xxxxxxx.pth&#034;)<\/p>\n<h4>6.1 \u4e24\u79cd\u4fdd\u5b58\u65b9\u5f0f\u7684\u5bf9\u6bd4<\/h4>\n<h5>\u65b9\u5f0f\u4e00&#xff1a;\u4fdd\u5b58\u6a21\u578b\u53c2\u6570&#xff08;state_dict&#xff09;<\/h5>\n<p>torch.save(model.state_dict(), &#034;xxxxxx.pth&#034;)<\/p>\n<p>\u4fdd\u5b58\u5185\u5bb9&#xff1a;\u4ec5\u4fdd\u5b58\u6a21\u578b\u7684\u53c2\u6570&#xff08;\u6743\u91cdw\u548c\u504f\u7f6eb&#xff09;&#xff0c;\u4e0d\u5305\u542b\u6a21\u578b\u7ed3\u6784\u3002<\/p>\n<p>\u52a0\u8f7d\u65b9\u5f0f&#xff1a;<\/p>\n<p>model &#061; CNN()  # \u5148\u5b9a\u4e49\u6a21\u578b\u7ed3\u6784<br \/>\nmodel.load_state_dict(torch.load(&#034;xxxxxx.pth&#034;))<br \/>\nmodel.eval()<\/p>\n<p>\u4f18\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6587\u4ef6\u5c0f&#xff0c;\u53ea\u4fdd\u5b58\u53c2\u6570<\/p>\n<\/li>\n<li>\n<p>\u7075\u6d3b&#xff0c;\u53ef\u4ee5\u52a0\u8f7d\u5230\u4e0d\u540c\u4f46\u7ed3\u6784\u76f8\u540c\u7684\u6a21\u578b<\/p>\n<\/li>\n<li>\n<p>\u662fPyTorch\u63a8\u8350\u7684\u65b9\u5f0f<\/p>\n<\/li>\n<\/ul>\n<p>\u7f3a\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u52a0\u8f7d\u65f6\u9700\u8981\u5148\u5b9a\u4e49\u6a21\u578b\u7ed3\u6784<\/p>\n<\/li>\n<\/ul>\n<h5>\u65b9\u5f0f\u4e8c&#xff1a;\u4fdd\u5b58\u5b8c\u6574\u6a21\u578b&#xff08;TorchScript&#xff09;<\/h5>\n<p>script_model &#061; torch.jit.script(model)<br \/>\ntorch.jit.save(script_model, &#034;xxxxxxx.pth&#034;)<\/p>\n<p>\u4fdd\u5b58\u5185\u5bb9&#xff1a;\u6a21\u578b\u7ed3\u6784 &#043; \u53c2\u6570 &#043; \u8ba1\u7b97\u56fe&#xff0c;\u662f\u4e00\u4e2a\u72ec\u7acb\u53ef\u6267\u884c\u7684\u6587\u4ef6\u3002<\/p>\n<p>\u52a0\u8f7d\u65b9\u5f0f&#xff1a;<\/p>\n<p>model &#061; torch.jit.load(&#034;xxxxxxx.pth&#034;)<br \/>\nmodel.eval()<\/p>\n<p>\u4f18\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u65e0\u9700\u5b9a\u4e49\u6a21\u578b\u7ed3\u6784&#xff0c;\u76f4\u63a5\u52a0\u8f7d\u5373\u53ef\u7528<\/p>\n<\/li>\n<li>\n<p>\u53ef\u4ee5\u8de8\u5e73\u53f0\u90e8\u7f72&#xff08;C&#043;&#043;\u3001\u79fb\u52a8\u7aef\u7b49&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u9002\u5408\u751f\u4ea7\u73af\u5883<\/p>\n<\/li>\n<\/ul>\n<p>\u7f3a\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6587\u4ef6\u8f83\u5927<\/p>\n<\/li>\n<li>\n<p>\u67d0\u4e9b\u590d\u6742\u52a8\u6001\u7ed3\u6784\u53ef\u80fd\u65e0\u6cd5\u811a\u672c\u5316<\/p>\n<\/li>\n<\/ul>\n<h4>6.2 \u6a21\u578b\u6587\u4ef6\u6269\u5c55\u540d<\/h4>\n<table>\n<tr>\u6269\u5c55\u540d\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>.pt \/ .pth<\/td>\n<td>PyTorch\u901a\u7528\u6a21\u578b\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>.t7<\/td>\n<td>Torch7\u683c\u5f0f&#xff08;\u65e7\u7248&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>.onnx<\/td>\n<td>\u5f00\u653e\u795e\u7ecf\u7f51\u7edc\u4ea4\u6362\u683c\u5f0f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>6.3 best_acc \u7684\u4f5c\u7528<\/h4>\n<p>if correct &gt; best_acc:<br \/>\n    best_acc &#061; correct<br \/>\n    # \u4fdd\u5b58\u6a21\u578b<\/p>\n<p>\u901a\u8fc7\u7ef4\u62a4\u4e00\u4e2a\u5168\u5c40\u7684 best_acc&#xff0c;\u53ea\u6709\u5f53\u5f53\u524depoch\u7684\u51c6\u786e\u7387\u8d85\u8fc7\u5386\u53f2\u6700\u4f18\u65f6\u624d\u4fdd\u5b58\u3002\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u4fdd\u5b58\u6548\u679c\u8f83\u5dee\u7684\u6a21\u578b&#xff0c;\u786e\u4fdd\u6700\u7ec8\u4fdd\u5b58\u7684\u662f\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u8868\u73b0\u6700\u597d\u7684\u7248\u672c\u3002<\/p>\n<h3>\u4e03\u3001\u5b8c\u6574\u8bad\u7ec3\u6d41\u7a0b<\/h3>\n<p>loss_fn &#061; nn.CrossEntropyLoss()<br \/>\noptimizer &#061; torch.optim.Adam(model.parameters(), lr&#061;0.001)<\/p>\n<p>epochs &#061; 10<br \/>\nfor t in range(epochs):<br \/>\n    print(f&#034;Epoch {t&#043;1}\\\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#034;)<br \/>\n    train(train_dataloader, model, loss_fn, optimizer)<br \/>\nprint(&#034;Done!&#034;)<br \/>\ntest(test_dataloader, model, loss_fn)<\/p>\n<p>\u6ce8\u610f&#xff1a;test() \u53ea\u5728\u8bad\u7ec3\u7ed3\u675f\u540e\u8c03\u7528\u4e00\u6b21\u3002\u5982\u679c\u5e0c\u671b\u5728\u6bcf\u4e2aepoch\u540e\u90fd\u8bc4\u4f30\u5e76\u4fdd\u5b58\u6700\u4f18\u6a21\u578b&#xff0c;\u53ef\u4ee5\u5728\u8bad\u7ec3\u5faa\u73af\u5185\u8c03\u7528 test()\u3002<\/p>\n<h3>\u516b\u3001\u6570\u636e\u589e\u5f3a\u7684\u6548\u679c\u5206\u6790<\/h3>\n<table>\n<tr>\u589e\u5f3a\u65b9\u6cd5\u6a21\u62df\u7684\u73b0\u5b9e\u53d8\u5316\u5bf9\u6a21\u578b\u7684\u5f71\u54cd<\/tr>\n<tbody>\n<tr>\n<td>RandomRotation<\/td>\n<td>\u62cd\u6444\u89d2\u5ea6\u4e0d\u540c<\/td>\n<td>\u63d0\u5347\u65cb\u8f6c\u4e0d\u53d8\u6027<\/td>\n<\/tr>\n<tr>\n<td>RandomFlip<\/td>\n<td>\u955c\u50cf\u62cd\u6444<\/td>\n<td>\u63d0\u5347\u7ffb\u8f6c\u4e0d\u53d8\u6027<\/td>\n<\/tr>\n<tr>\n<td>ColorJitter<\/td>\n<td>\u5149\u7167\u6761\u4ef6\u4e0d\u540c<\/td>\n<td>\u63d0\u5347\u5149\u7167\u9c81\u68d2\u6027<\/td>\n<\/tr>\n<tr>\n<td>RandomGrayscale<\/td>\n<td>\u9ed1\u767d\u7167\u7247<\/td>\n<td>\u51cf\u5c11\u5bf9\u989c\u8272\u7684\u4f9d\u8d56<\/td>\n<\/tr>\n<tr>\n<td>Normalize<\/td>\n<td>\u6570\u636e\u5206\u5e03\u7edf\u4e00<\/td>\n<td>\u52a0\u901f\u6536\u655b&#xff0c;\u63d0\u5347\u7a33\u5b9a\u6027<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5b9e\u8df5\u5efa\u8bae&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6570\u636e\u589e\u5f3a\u4e0d\u662f\u8d8a\u591a\u8d8a\u597d&#xff0c;\u8981\u6839\u636e\u4efb\u52a1\u7279\u70b9\u9009\u62e9<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u4e8e\u4eba\u8138\u8bc6\u522b&#xff0c;\u5782\u76f4\u7ffb\u8f6c\u901a\u5e38\u4e0d\u5408\u9002&#xff08;\u4eba\u8138\u6709\u65b9\u5411\u6027&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u4e8e\u98df\u7269\u5206\u7c7b&#xff0c;\u65cb\u8f6c\u3001\u7ffb\u8f6c\u3001\u989c\u8272\u6296\u52a8\u90fd\u5f88\u5408\u9002<\/p>\n<\/li>\n<li>\n<p>\u9a8c\u8bc1\u96c6\u5fc5\u987b\u4f7f\u7528\u4e0e\u6d4b\u8bd5\u96c6\u76f8\u540c\u7684\u53d8\u6362&#xff0c;\u4e0d\u80fd\u52a0\u5165\u968f\u673a\u6027<\/p>\n<\/li>\n<\/ul>\n<h3>\u4e5d\u3001\u603b\u7ed3<\/h3>\n<p>\u672c\u7bc7\u535a\u5ba2\u56f4\u7ed5\u6570\u636e\u589e\u5f3a\u548c\u6a21\u578b\u4fdd\u5b58\u4e24\u5927\u4e3b\u9898&#xff0c;\u7cfb\u7edf\u8bb2\u89e3\u4e86&#xff1a;<\/p>\n<table>\n<tr>\u77e5\u8bc6\u70b9\u6838\u5fc3\u5185\u5bb9<\/tr>\n<tbody>\n<tr>\n<td>\u6570\u636e\u589e\u5f3a<\/td>\n<td>RandomRotation\u3001RandomFlip\u3001ColorJitter\u3001RandomGrayscale<\/td>\n<\/tr>\n<tr>\n<td>\u6807\u51c6\u5316<\/td>\n<td>ToTensor &#043; Normalize&#xff0c;\u4f7f\u7528ImageNet\u7edf\u8ba1\u53c2\u6570<\/td>\n<\/tr>\n<tr>\n<td>\u8bad\u7ec3\/\u9a8c\u8bc1\u53d8\u6362<\/td>\n<td>\u8bad\u7ec3\u96c6\u7528\u589e\u5f3a&#xff0c;\u9a8c\u8bc1\u96c6\u53ea\u7528\u5fc5\u8981\u53d8\u6362<\/td>\n<\/tr>\n<tr>\n<td>\u6a21\u578b\u4fdd\u5b58\u65b9\u5f0f\u4e00<\/td>\n<td>torch.save(model.state_dict())&#xff0c;\u4fdd\u5b58\u53c2\u6570<\/td>\n<\/tr>\n<tr>\n<td>\u6a21\u578b\u4fdd\u5b58\u65b9\u5f0f\u4e8c<\/td>\n<td>torch.jit.script() &#043; torch.jit.save()&#xff0c;\u4fdd\u5b58\u5b8c\u6574\u6a21\u578b<\/td>\n<\/tr>\n<tr>\n<td>\u6700\u4f18\u6a21\u578b\u4fdd\u5b58<\/td>\n<td>\u7528 best_acc \u8ffd\u8e2a&#xff0c;\u53ea\u4fdd\u5b58\u6700\u597d\u7684\u7248\u672c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6838\u5fc3\u6536\u83b7&#xff1a;<\/p>\n<li>\n<p>\u6570\u636e\u589e\u5f3a\u662f\u63d0\u5347\u6a21\u578b\u6cdb\u5316\u80fd\u529b\u7684\u5173\u952e\u624b\u6bb5&#xff0c;\u76f8\u5f53\u4e8e\u201c\u514d\u8d39\u201d\u6269\u5145\u6570\u636e\u96c6\u3002<\/p>\n<\/li>\n<li>\n<p>\u6807\u51c6\u5316\u662f\u6df1\u5ea6\u5b66\u4e60\u8bad\u7ec3\u7684\u6807\u51c6\u6b65\u9aa4&#xff0c;\u4e0d\u53ef\u7701\u7565\u3002<\/p>\n<\/li>\n<li>\n<p>\u6a21\u578b\u4fdd\u5b58\u8ba9\u8bad\u7ec3\u6210\u679c\u53ef\u590d\u7528&#xff0c;\u662f\u5de5\u7a0b\u843d\u5730\u7684\u5fc5\u8981\u73af\u8282\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e24\u79cd\u4fdd\u5b58\u65b9\u5f0f\u5404\u6709\u4f18\u52a3&#xff0c;\u6839\u636e\u90e8\u7f72\u9700\u6c42\u9009\u62e9\u3002<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u5f15\u8a00&#xff1a;\u8ba9\u6a21\u578b\u957f\u89c1\u8bc6&#xff0c;\u8ba9\u6210\u679c\u7559\u4e0b\u6765\u5728\u524d\u4e24\u7bc7\u535a\u5ba2\u4e2d&#xff0c;\u6211\u4eec\u5b8c\u6210\u4e86\u4ece\u81ea\u5b9a\u4e49\u6570\u636e\u96c6\u5230CNN\u6a21\u578b\u8bad\u7ec3\u7684\u5b8c\u6574\u6d41\u7a0b\u3002\u4f46\u5982\u679c\u4f60\u4ed4\u7ec6\u56de\u987e&#xff0c;\u4f1a\u53d1\u73b0\u4e00\u4e2a\u6f5c\u5728\u7684\u95ee\u9898&#xff1a;\u8bad\u7ec3\u6570\u636e\u592a\u5355\u4e00\u3002\u6a21\u578b\u53ea\u89c1\u8fc7\u6b63\u7740\u6446\u653e\u7684\u3001\u4eae\u5ea6\u56fa\u5b9a\u7684\u3001\u540c\u4e00\u89d2\u5ea6\u7684\u7269\u54c1\u3002\u4e00\u65e6\u6d4b\u8bd5\u56fe\u7247\u7a0d\u6709\u65cb\u8f6c\u3001\u7ffb\u8f6c\u6216\u989c\u8272\u53d8\u5316&#xff0c;\u6a21\u578b\u5c31\u53ef\u80fd\u50bb\u773c\u2014\u2014\u8fd9\u5c31\u662f\u6240\u8c13\u7684\u8fc7\u62df\u5408\u3002\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u5229\u5668&#xff0c;\u5c31\u662f\u6570\u636e\u589e\u5f3a&#xff08;Data Augmentation&amp;#xff09<\/p>\n","protected":false},"author":2,"featured_media":105110,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[50,86],"topic":[],"class_list":["post-105111","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-50","tag-86"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u521d\u8bc6\u6df1\u5ea6\u5b66\u4e60\u2014\u2014\u6570\u636e\u589e\u5f3a\u4e0e\u6a21\u578b\u4fdd\u5b58 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/105111.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u521d\u8bc6\u6df1\u5ea6\u5b66\u4e60\u2014\u2014\u6570\u636e\u589e\u5f3a\u4e0e\u6a21\u578b\u4fdd\u5b58 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u5f15\u8a00&#xff1a;\u8ba9\u6a21\u578b\u957f\u89c1\u8bc6&#xff0c;\u8ba9\u6210\u679c\u7559\u4e0b\u6765\u5728\u524d\u4e24\u7bc7\u535a\u5ba2\u4e2d&#xff0c;\u6211\u4eec\u5b8c\u6210\u4e86\u4ece\u81ea\u5b9a\u4e49\u6570\u636e\u96c6\u5230CNN\u6a21\u578b\u8bad\u7ec3\u7684\u5b8c\u6574\u6d41\u7a0b\u3002\u4f46\u5982\u679c\u4f60\u4ed4\u7ec6\u56de\u987e&#xff0c;\u4f1a\u53d1\u73b0\u4e00\u4e2a\u6f5c\u5728\u7684\u95ee\u9898&#xff1a;\u8bad\u7ec3\u6570\u636e\u592a\u5355\u4e00\u3002\u6a21\u578b\u53ea\u89c1\u8fc7\u6b63\u7740\u6446\u653e\u7684\u3001\u4eae\u5ea6\u56fa\u5b9a\u7684\u3001\u540c\u4e00\u89d2\u5ea6\u7684\u7269\u54c1\u3002\u4e00\u65e6\u6d4b\u8bd5\u56fe\u7247\u7a0d\u6709\u65cb\u8f6c\u3001\u7ffb\u8f6c\u6216\u989c\u8272\u53d8\u5316&#xff0c;\u6a21\u578b\u5c31\u53ef\u80fd\u50bb\u773c\u2014\u2014\u8fd9\u5c31\u662f\u6240\u8c13\u7684\u8fc7\u62df\u5408\u3002\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u5229\u5668&#xff0c;\u5c31\u662f\u6570\u636e\u589e\u5f3a&#xff08;Data Augmentation&amp;#xff09\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/105111.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-13T12:57:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260913125708-6aa69da4d3b53.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/105111.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/105111.html\",\"name\":\"\u521d\u8bc6\u6df1\u5ea6\u5b66\u4e60\u2014\u2014\u6570\u636e\u589e\u5f3a\u4e0e\u6a21\u578b\u4fdd\u5b58 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-13T12:57:09+00:00\",\"dateModified\":\"2026-09-13T12:57:09+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/105111.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/105111.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/105111.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u521d\u8bc6\u6df1\u5ea6\u5b66\u4e60\u2014\u2014\u6570\u636e\u589e\u5f3a\u4e0e\u6a21\u578b\u4fdd\u5b58\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u521d\u8bc6\u6df1\u5ea6\u5b66\u4e60\u2014\u2014\u6570\u636e\u589e\u5f3a\u4e0e\u6a21\u578b\u4fdd\u5b58 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/105111.html","og_locale":"zh_CN","og_type":"article","og_title":"\u521d\u8bc6\u6df1\u5ea6\u5b66\u4e60\u2014\u2014\u6570\u636e\u589e\u5f3a\u4e0e\u6a21\u578b\u4fdd\u5b58 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u5f15\u8a00&#xff1a;\u8ba9\u6a21\u578b\u957f\u89c1\u8bc6&#xff0c;\u8ba9\u6210\u679c\u7559\u4e0b\u6765\u5728\u524d\u4e24\u7bc7\u535a\u5ba2\u4e2d&#xff0c;\u6211\u4eec\u5b8c\u6210\u4e86\u4ece\u81ea\u5b9a\u4e49\u6570\u636e\u96c6\u5230CNN\u6a21\u578b\u8bad\u7ec3\u7684\u5b8c\u6574\u6d41\u7a0b\u3002\u4f46\u5982\u679c\u4f60\u4ed4\u7ec6\u56de\u987e&#xff0c;\u4f1a\u53d1\u73b0\u4e00\u4e2a\u6f5c\u5728\u7684\u95ee\u9898&#xff1a;\u8bad\u7ec3\u6570\u636e\u592a\u5355\u4e00\u3002\u6a21\u578b\u53ea\u89c1\u8fc7\u6b63\u7740\u6446\u653e\u7684\u3001\u4eae\u5ea6\u56fa\u5b9a\u7684\u3001\u540c\u4e00\u89d2\u5ea6\u7684\u7269\u54c1\u3002\u4e00\u65e6\u6d4b\u8bd5\u56fe\u7247\u7a0d\u6709\u65cb\u8f6c\u3001\u7ffb\u8f6c\u6216\u989c\u8272\u53d8\u5316&#xff0c;\u6a21\u578b\u5c31\u53ef\u80fd\u50bb\u773c\u2014\u2014\u8fd9\u5c31\u662f\u6240\u8c13\u7684\u8fc7\u62df\u5408\u3002\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u5229\u5668&#xff0c;\u5c31\u662f\u6570\u636e\u589e\u5f3a&#xff08;Data Augmentation&amp;#xff09","og_url":"https:\/\/www.wsisp.com\/helps\/105111.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-13T12:57:09+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260913125708-6aa69da4d3b53.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/105111.html","url":"https:\/\/www.wsisp.com\/helps\/105111.html","name":"\u521d\u8bc6\u6df1\u5ea6\u5b66\u4e60\u2014\u2014\u6570\u636e\u589e\u5f3a\u4e0e\u6a21\u578b\u4fdd\u5b58 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-13T12:57:09+00:00","dateModified":"2026-09-13T12:57:09+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/105111.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/105111.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/105111.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u521d\u8bc6\u6df1\u5ea6\u5b66\u4e60\u2014\u2014\u6570\u636e\u589e\u5f3a\u4e0e\u6a21\u578b\u4fdd\u5b58"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/105111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=105111"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/105111\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/105110"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=105111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=105111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=105111"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=105111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}