先在github上新建乙個專案用於記錄
最終達成識別天池報名的後獲得的資料中的數字。
使用**:
效果圖:from pil import image
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm, tqdm_notebook
import torch
torch.manual_seed(0)
torch.backends.cudnn.deterministic =
false
torch.backends.cudnn.benchmark =
true
import torchvision.models as models
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import torch.nn as nn
import torch.nn.functional as f
import torch.optim as optim
from torch.autograd import variable
from torch.utils.data.dataset import dataset
defparse_json
(d):
arr = np.array(
[ d[
'top'
], d[
'height'
], d[
'left'
], d[
'width'
], d[
'label']]
) arr = arr.astype(
int)
return arr
img = cv2.imread(
'../input/mchar_train/000001.png'
)arr = parse_json(train_json[
'000001.png'])
plt.figure(figsize=(10
,10))
plt.subplot(
1, arr.shape[1]
+1,1
)plt.imshow(img)
plt.xticks(
); plt.yticks(
)for idx in
range
(arr.shape[1]
):plt.subplot(
1, arr.shape[1]
+1, idx+2)
plt.imshow(img[arr[
0, idx]
:arr[
0, idx]
+arr[
1, idx]
,arr[
2, idx]
:arr[
2, idx]
+arr[
3, idx]])
plt.title(arr[
4, idx]
) plt.xticks(
); plt.yticks(
)
![](https://pic.w3help.cc/fed/7c99f0f2d8aa7eb52517faca8fab8.jpeg)
torchvision,torch安裝教程**:可參考兩者安裝
零基礎入門CV賽事 Task1 賽題理解
賽題名稱 零基礎入門cv之街道字元識別 賽題目標 通過這道賽題可以引導大家走入計算機視覺的世界,主要針對競賽選手上手視覺賽題,提高對資料建模能力。賽題任務 賽題以計算機視覺中字元識別為背景,要求選手 街道字元編碼,這是乙個典型的字元識別問題。為了簡化賽題難度,賽題資料採用公開資料集svhn,因此大家...
零基礎入門CV賽事 Task1 賽題理解
賽題目標 通過這道賽題可以引導大家走入計算機視覺的世界,主要針對競賽選手上手視覺賽題,提高對資料建模能力。賽題任務 賽題以計算機視覺中字元識別為背景,要求選手 街道字元編碼,這是乙個典型的字元識別問題。import json train json json.load open r d study c...
零基礎入門CV賽事 Task1 賽題理解
賽題名稱 零基礎入門cv之街道字元識別 賽題任務 賽題以計算機視覺中字元識別為背景,要求選手 街道字元編碼,這是乙個典型的字元識別問題。注意 按照比賽規則,只能使用比賽給定的資料集完成訓練,不能使用svhn原始資料集。訓練集包括3w張 驗證集包括1w張 每張 包括顏色影象和對應的編碼類別和具體位置 ...