自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中常見(jiàn)的Bug

開(kāi)發(fā) 前端 深度學(xué)習(xí)
給大家總結(jié)了8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中的常見(jiàn)bug,相信大家或多或少都遇到過(guò),希望能幫助大家避免一些問(wèn)題。

給大家總結(jié)了8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中的常見(jiàn)bug,相信大家或多或少都遇到過(guò),希望能幫助大家避免一些問(wèn)題。

[[285233]]

人是不完美的,我們經(jīng)常在軟件中犯錯(cuò)誤。有時(shí)這些錯(cuò)誤很容易發(fā)現(xiàn):你的代碼根本不能工作,你的應(yīng)用程序崩潰等等。但是有些bug是隱藏的,這使得它們更加危險(xiǎn)。

在解決深度學(xué)習(xí)問(wèn)題時(shí),由于一些不確定性,很容易出現(xiàn)這種類型的bug:很容易看到web應(yīng)用程序路由請(qǐng)求是否正確,而不容易檢查你的梯度下降步驟是否正確。然而,有很多錯(cuò)誤是可以避免的。 

8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中常見(jiàn)的Bug

我想分享一些我的經(jīng)驗(yàn),關(guān)于我在過(guò)去兩年的計(jì)算機(jī)視覺(jué)工作中看到或制造的錯(cuò)誤。我(在會(huì)議上)談到過(guò)這個(gè)話題(https://datafest.ru/ia/),很多人在會(huì)后告訴我:“是的,我也有很多這樣的bug。”我希望我的文章可以幫助你至少避免其中的一些問(wèn)題。

1. 翻轉(zhuǎn)圖片以及關(guān)鍵點(diǎn).

假設(shè)在關(guān)鍵點(diǎn)檢測(cè)的問(wèn)題上。數(shù)據(jù)看起來(lái)像一對(duì)圖像和一系列的關(guān)鍵點(diǎn)元組。其中每個(gè)關(guān)鍵點(diǎn)是一對(duì)x和y坐標(biāo)。

讓我們對(duì)這個(gè)數(shù)據(jù)進(jìn)行基礎(chǔ)的增強(qiáng): 

  1. def flip_img_and_keypoints(img: np.ndarray, kpts: Sequence[Sequence[int]]):  
  2.  img = np.fliplr(img) 
  3.  h, w, *_ = img.shape 
  4.  kpts = [(y, w - x) for y, x in kpts] 
  5.  return img, kpts 

看起來(lái)是正確的,嗯?我們把它可視化。 

  1. image = np.ones((10, 10), dtype=np.float32) 
  2. kpts = [(0, 1), (2, 2)] 
  3. image_flipped, kpts_flipped = flip_img_and_keypoints(image, kpts) 
  4. img1 = image.copy() 
  5. for y, x in kpts: 
  6.  img1[y, x] = 0 
  7. img2 = image_flipped.copy() 
  8. for y, x in kpts_flipped: 
  9.  img2[y, x] = 0 
  10.   
  11. _ = plt.imshow(np.hstack((img1, img2))) 

8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中常見(jiàn)的Bug 

不對(duì)稱,看起來(lái)很奇怪!如果我們檢查極值呢? 

  1. image = np.ones((10, 10), dtype=np.float32) 

不好!這是一個(gè)典型的off-by-one錯(cuò)誤。正確的代碼是這樣的: 

  1. def flip_img_and_keypoints(img: np.ndarray, kpts: Sequence[Sequence[int]]):  
  2.  img = np.fliplr(img) 
  3.  h, w, *_ = img.shape 
  4.  kpts = [(y, w - x - 1) for y, x in kpts] 
  5.  return img, kpts 

我們通過(guò)可視化發(fā)現(xiàn)了這個(gè)問(wèn)題,但是,使用“x = 0”點(diǎn)進(jìn)行單元測(cè)試也會(huì)有所幫助。一個(gè)有趣的事實(shí)是:有一個(gè)團(tuán)隊(duì)中有三個(gè)人(包括我自己)獨(dú)立地犯了幾乎相同的錯(cuò)誤。

2. 繼續(xù)是關(guān)鍵點(diǎn)相關(guān)的問(wèn)題

即使在上面的函數(shù)被修復(fù)之后,仍然存在危險(xiǎn)?,F(xiàn)在更多的是語(yǔ)義,而不僅僅是一段代碼。

假設(shè)需要用兩只手掌來(lái)增強(qiáng)圖像??雌饋?lái)很安全:手是左,右翻轉(zhuǎn)。 

8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中常見(jiàn)的Bug

但是等等!我們對(duì)關(guān)鍵點(diǎn)的語(yǔ)義并不很了解。如果這個(gè)關(guān)鍵點(diǎn)的意思是這樣的: 

  1. kpts = [ 
  2.  (20, 20), # left pinky 
  3.  (20, 200), # right pinky 
  4.  ... 
  5.  ] 

8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中常見(jiàn)的Bug 

這意味著增強(qiáng)實(shí)際上改變了語(yǔ)義:左變成右,右變成左,但我們不交換數(shù)組中的關(guān)鍵點(diǎn)索引。它會(huì)給訓(xùn)練帶來(lái)大量的噪音和更糟糕的度量。

我們應(yīng)該吸取一個(gè)教訓(xùn):

  • 在應(yīng)用增強(qiáng)或其他花哨的功能之前,了解并考慮數(shù)據(jù)結(jié)構(gòu)和語(yǔ)義
  • 保持你的實(shí)驗(yàn)原子性:添加一個(gè)小的變化(例如一個(gè)新的變換),檢查它如何進(jìn)行,如果分?jǐn)?shù)提高才加進(jìn)去。

3. 編寫(xiě)自己的損失函數(shù)

熟悉語(yǔ)義分割問(wèn)題的人可能知道IoU指標(biāo)。不幸的是,我們不能直接用SGD來(lái)優(yōu)化它,所以常用的方法是用可微損失函數(shù)來(lái)近似它。 

  1. def iou_continuous_loss(y_pred, y_true): 
  2.  eps = 1e-6 
  3.  def _sum(x): 
  4.  return x.sum(-1).sum(-1) 
  5.  numerator = (_sum(y_true * y_pred) + eps) 
  6.  denominator = (_sum(y_true ** 2) + _sum(y_pred ** 2) 
  7.  - _sum(y_true * y_pred) + eps) 
  8.  return (numerator / denominator).mean() 

看起來(lái)不錯(cuò),我們先做個(gè)小的檢查: 

  1. In [3]: ones = np.ones((1, 3, 10, 10)) 
  2.  ...: x1 = iou_continuous_loss(ones * 0.01, ones) 
  3.  ...: x2 = iou_continuous_loss(ones * 0.99, ones) 
  4. In [4]: x1, x2 
  5. Out[4]: (0.010099999897990103, 0.9998990001020204) 

在 x1中,我們計(jì)算了一些與ground truth完全不同的東西的損失,而 x2則是非常接近ground truth的東西的結(jié)果。我們預(yù)計(jì) x1會(huì)很大,因?yàn)轭A(yù)測(cè)是錯(cuò)誤的, x2應(yīng)該接近于零。怎么了?

上面的函數(shù)是對(duì)metric的一個(gè)很好的近似。metric不是一種損失:它通常(包括這種情況)越高越好。當(dāng)我們使用SGD來(lái)最小化損失時(shí),我們應(yīng)該使用一些相反的東西: 

  1. def iou_continuous(y_pred, y_true): 
  2.  eps = 1e-6 
  3.  def _sum(x): 
  4.  return x.sum(-1).sum(-1) 
  5.  numerator = (_sum(y_true * y_pred) + eps) 
  6.  denominator = (_sum(y_true ** 2) + _sum(y_pred ** 2) 
  7.  - _sum(y_true * y_pred) + eps) 
  8.  return (numerator / denominator).mean() 
  9. def iou_continuous_loss(y_pred, y_true): 
  10.  return 1 - iou_continuous(y_pred, y_true) 

這些問(wèn)題可以從兩個(gè)方面來(lái)確定:

  • 編寫(xiě)一個(gè)單元測(cè)試,檢查損失的方向:形式化的期望,更接近ground truth應(yīng)該輸出更低的損失。
  • 運(yùn)行一個(gè)健全的檢查,讓你的模型在單個(gè)batch中過(guò)擬合。

4. 當(dāng)我們使用Pytorch的時(shí)候

假設(shè)有一個(gè)預(yù)先訓(xùn)練好的模型,開(kāi)始做infer。 

  1. from ceevee.base import AbstractPredictor 
  2. class MySuperPredictor(AbstractPredictor): 
  3.  def __init__(self, 
  4.  weights_path: str, 
  5.  ): 
  6.  super().__init__() 
  7.  self.model = self._load_model(weights_path=weights_path) 
  8.  def process(self, x, *kw): 
  9.  with torch.no_grad(): 
  10.  res = self.model(x) 
  11.  return res 
  12.  @staticmethod 
  13.  def _load_model(weights_path): 
  14.  model = ModelClass() 
  15.  weights = torch.load(weights_path, map_location='cpu'
  16.  model.load_state_dict(weights) 
  17.  return model 

這個(gè)代碼正確嗎?也許!這確實(shí)適用于某些模型。例如,當(dāng)模型沒(méi)有dropout或norm層,如 torch.nn.BatchNorm2d?;蛘弋?dāng)模型需要為每個(gè)圖像使用實(shí)際的norm統(tǒng)計(jì)量時(shí)(例如,許多基于pix2pix的架構(gòu)需要它)。

但是對(duì)于大多數(shù)計(jì)算機(jī)視覺(jué)應(yīng)用程序來(lái)說(shuō),代碼忽略了一些重要的東西:切換到評(píng)估模式。

如果試圖將動(dòng)態(tài)PyTorch圖轉(zhuǎn)換為靜態(tài)PyTorch圖,這個(gè)問(wèn)題很容易識(shí)別。 torch.jit用于這種轉(zhuǎn)換。 

  1. In [3]: model = nn.Sequential( 
  2.  ...: nn.Linear(10, 10), 
  3.  ...: nn.Dropout(.5) 
  4.  ...: ) 
  5.  ...: 
  6.  ...: traced_model = torch.jit.trace(model, torch.rand(10)) 
  7. /Users/Arseny/.pyenv/versions/3.6.6/lib/python3.6/site-packages/torch/jit/__init__.py:914: TracerWarning: Trace had nondeterministic nodes. Did you forget call .eval() on your model? Nodes: 
  8.     %12 : Float(10) = aten::dropout(%input, %10, %11), scope: Sequential/Dropout[1] # /Users/Arseny/.pyenv/versions/3.6.6/lib/python3.6/site-packages/torch/nn/functional.py:806:0 
  9. This may cause errors in trace checking. To disable trace checking, pass check_trace=False to torch.jit.trace() 
  10.  check_tolerance, _force_outplace, True, _module_class) 
  11. /Users/Arseny/.pyenv/versions/3.6.6/lib/python3.6/site-packages/torch/jit/__init__.py:914: TracerWarning: Output nr 1. of the traced function does not match the corresponding output of the Python function. Detailed error: 
  12. Not within tolerance rtol=1e-05 atol=1e-05 at input[5] (0.0 vs. 0.5454154014587402) and 5 other locations (60.00%) 
  13. check_tolerance, _force_outplace, True, _module_class) 

簡(jiǎn)單的修復(fù)一下: 

  1. In [4]: model = nn.Sequential( 
  2.  ...: nn.Linear(10, 10), 
  3.  ...: nn.Dropout(.5) 
  4.  ...: ) 
  5.  ...: 
  6.  ...: traced_model = torch.jit.trace(model.eval(), torch.rand(10)) 
  7.  # No more warnings! 

在這種情況下, torch.jit.trace將模型運(yùn)行幾次并比較結(jié)果。這里的差別是可疑的。

然而 torch.jit.trace在這里不是萬(wàn)能藥。這是一種應(yīng)該知道和記住的細(xì)微差別。

5. 復(fù)制粘貼的問(wèn)題

很多東西都是成對(duì)存在的:訓(xùn)練和驗(yàn)證、寬度和高度、緯度和經(jīng)度…… 

  1. def make_dataloaders(train_cfg, val_cfg, batch_size): 
  2.  train = Dataset.from_config(train_cfg) 
  3.  val = Dataset.from_config(val_cfg) 
  4.  shared_params = {'batch_size': batch_size, 'shuffle'True'num_workers': cpu_count()} 
  5.  train = DataLoader(train, **shared_params) 
  6.  val = DataLoader(train, **shared_params) 
  7.  return train, val 

不僅僅是我犯了愚蠢的錯(cuò)誤。例如,在非常流行的albumentations庫(kù)也有一個(gè)類似的版本。 

  1. # https://github.com/albu/albumentations/blob/0.3.0/albumentations/augmentations/transforms.py 
  2. def apply_to_keypoint(self, keypoint, crop_height=0, crop_width=0, h_start=0, w_start=0, rows=0, cols=0, **params): 
  3.  keypoint = F.keypoint_random_crop(keypoint, crop_height, crop_width, h_start, w_start, rows, cols) 
  4.  scale_x = self.width / crop_height 
  5.  scale_y = self.height / crop_height 
  6.  keypoint = F.keypoint_scale(keypoint, scale_x, scale_y) 
  7.  return keypoint 

別擔(dān)心,已經(jīng)修改好了。

如何避免?不要復(fù)制和粘貼代碼,盡量以不需要復(fù)制和粘貼的方式編寫(xiě)代碼。 

  1. datasets = [] 
  2. data_a = get_dataset(MyDataset(config['dataset_a']), config['shared_param'], param_a) 
  3. datasets.append(data_a) 
  4. data_b = get_dataset(MyDataset(config['dataset_b']), config['shared_param'], param_b) 
  5. datasets.append(data_b)  
  1. datasets = [] 
  2. for name, param in zip(('dataset_a''dataset_b'),  
  3.  (param_a, param_b), 
  4.  ): 
  5.  datasets.append(get_dataset(MyDataset(config[name]), config['shared_param'], param)) 

6. 合適的數(shù)據(jù)類型

讓我們編寫(xiě)一個(gè)新的增強(qiáng): 

  1. def add_noise(img: np.ndarray) -> np.ndarray: 
  2.  mask = np.random.rand(*img.shape) + .5 
  3.  img = img.astype('float32') * mask 
  4.  return img.astype('uint8'

8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中常見(jiàn)的Bug 

圖像已被更改。這是我們所期望的嗎?嗯,也許它改變得太多了。

這里有一個(gè)危險(xiǎn)的操作:將 float32 轉(zhuǎn)換為 uint8。它可能會(huì)導(dǎo)致溢出: 

  1. def add_noise(img: np.ndarray) -> np.ndarray: 
  2.  mask = np.random.rand(*img.shape) + .5 
  3.  img = img.astype('float32') * mask 
  4.  return np.clip(img, 0, 255).astype('uint8'
  5. img = add_noise(cv2.imread('two_hands.jpg')[:, :, ::-1])  
  6. _ = plt.imshow(img) 

8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中常見(jiàn)的Bug 

看起來(lái)好多了,是吧?

順便說(shuō)一句,還有一種方法可以避免這個(gè)問(wèn)題:不要重新發(fā)明輪子,不要從頭開(kāi)始編寫(xiě)增強(qiáng)代碼并使用現(xiàn)有的擴(kuò)展: albumentations.augmentations.transforms.GaussNoise。

我曾經(jīng)做過(guò)另一個(gè)同樣起源的bug。 

  1. raw_mask = cv2.imread('mask_small.png'
  2. mask = raw_mask.astype('float32') / 255 
  3. mask = cv2.resize(mask, (64, 64), interpolation=cv2.INTER_LINEAR) 
  4. mask = cv2.resize(mask, (128, 128), interpolation=cv2.INTER_CUBIC) 
  5. mask = (mask * 255).astype('uint8'
  6. _ = plt.imshow(np.hstack((raw_mask, mask))) 

這里出了什么問(wèn)題?首先,用三次插值調(diào)整掩模的大小是一個(gè)壞主意。同樣的問(wèn)題 float32到 uint8:三次插值可以輸出值大于輸入,這會(huì)導(dǎo)致溢出。 

8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中常見(jiàn)的Bug

我在做可視化的時(shí)候發(fā)現(xiàn)了這個(gè)問(wèn)題。在你的訓(xùn)練循環(huán)中到處放置斷言也是一個(gè)好主意。

7. 拼寫(xiě)錯(cuò)誤

假設(shè)需要對(duì)全卷積網(wǎng)絡(luò)(如語(yǔ)義分割問(wèn)題)和一個(gè)巨大的圖像進(jìn)行推理。該圖像是如此巨大,沒(méi)有機(jī)會(huì)把它放在你的GPU中,它可以是一個(gè)醫(yī)療或衛(wèi)星圖像。

在這種情況下,可以將圖像分割成網(wǎng)格,獨(dú)立地對(duì)每一塊進(jìn)行推理,最后合并。此外,一些預(yù)測(cè)交叉可能有助于平滑邊界附近的artifacts。 

  1. from tqdm import tqdm 
  2. class GridPredictor: 
  3.  ""
  4.  This class can be used to predict a segmentation mask for the big image  
  5.  when you have GPU memory limitation 
  6.  ""
  7.  def __init__(self, predictor: AbstractPredictor, sizeint, stride: Optional[int] = None): 
  8.  self.predictor = predictor 
  9.  self.size = size 
  10.  self.stride = stride if stride is not None else size // 2 
  11.  def __call__(self, x: np.ndarray): 
  12.  h, w, _ = x.shape 
  13.  mask = np.zeros((h, w, 1), dtype='float32'
  14.  weights = mask.copy() 
  15.  for i in tqdm(range(0, h - 1, self.stride)): 
  16.  for j in range(0, w - 1, self.stride): 
  17.  a, b, c, d = i, min(h, i + self.size), j, min(w, j + self.size
  18.  patch = x[a:b, c:d, :] 
  19.  mask[a:b, c:d, :] += np.expand_dims(self.predictor(patch), -1) 
  20.  weights[a:b, c:d, :] = 1 
  21.  return mask / weights 

有一個(gè)符號(hào)輸入錯(cuò)誤,代碼段足夠大,可以很容易地找到它。我懷疑僅僅通過(guò)代碼就能快速識(shí)別它。但是很容易檢查代碼是否正確: 

  1. class Model(nn.Module): 
  2.  def forward(self, x): 
  3.  return x.mean(axis=-1) 
  4. model = Model() 
  5. grid_predictor = GridPredictor(model, size=128, stride=64) 
  6. simple_pred = np.expand_dims(model(img), -1)  
  7. grid_pred = grid_predictor(img) 
  8. np.testing.assert_allclose(simple_pred, grid_pred, atol=.001) 
  9. --------------------------------------------------------------------------- 
  10. AssertionError Traceback (most recent call last
  11. <ipython-input-24-a72034c717e9> in <module> 
  12.  9 grid_pred = grid_predictor(img) 
  13.  10  
  14. ---> 11 np.testing.assert_allclose(simple_pred, grid_pred, atol=.001) 
  15. ~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/numpy/testing/_private/utils.py in assert_allclose(actual, desired, rtol, atol, equal_nan, err_msg, verbose) 
  16.  1513 header = 'Not equal to tolerance rtol=%g, atol=%g' % (rtol, atol) 
  17.  1514 assert_array_compare(compare, actual, desired, err_msg=str(err_msg), 
  18. -> 1515 verbose=verbose, header=header, equal_nan=equal_nan) 
  19.  1516  
  20.  1517  
  21. ~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/numpy/testing/_private/utils.py in assert_array_compare(comparison, x, y, err_msg, verbose, header, precision, equal_nan, equal_inf) 
  22.  839 verbose=verbose, header=header, 
  23.  840 names=('x''y'), precision=precision
  24. --> 841 raise AssertionError(msg) 
  25.  842 except ValueError: 
  26.  843 import traceback 
  27. AssertionError:  
  28. Not equal to tolerance rtol=1e-07, atol=0.001 
  29. Mismatch: 99.6% 
  30. Max absolute difference: 765. 
  31. Max relative difference: 0.75000001 
  32.  x: array([[[215.333333], 
  33.  [192.666667], 
  34.  [250. ],... 
  35.  y: array([[[ 215.33333], 
  36.  [ 192.66667], 
  37.  [ 250. ],... 

下面是 __call__方法的正確版本: 

  1. def __call__(self, x: np.ndarray): 
  2.  h, w, _ = x.shape 
  3.  mask = np.zeros((h, w, 1), dtype='float32'
  4.  weights = mask.copy() 
  5.  for i in tqdm(range(0, h - 1, self.stride)): 
  6.  for j in range(0, w - 1, self.stride): 
  7.  a, b, c, d = i, min(h, i + self.size), j, min(w, j + self.size
  8.  patch = x[a:b, c:d, :] 
  9.  mask[a:b, c:d, :] += np.expand_dims(self.predictor(patch), -1) 
  10.  weights[a:b, c:d, :] += 1 
  11.  return mask / weights 

如果你仍然不知道問(wèn)題出在哪里,請(qǐng)注意 weights[a:b,c:d,:]+=1這一行。

8. Imagenet歸一化

當(dāng)一個(gè)人需要進(jìn)行轉(zhuǎn)移學(xué)習(xí)時(shí),用訓(xùn)練Imagenet時(shí)的方法將圖像歸一化通常是一個(gè)好主意。

讓我們使用我們已經(jīng)熟悉的albumentations庫(kù)。 

  1. from albumentations import Normalize 
  2. norm = Normalize() 
  3. img = cv2.imread('img_small.jpg'
  4. mask = cv2.imread('mask_small.png', cv2.IMREAD_GRAYSCALE) 
  5. mask = np.expand_dims(mask, -1) # shape (64, 64) -> shape (64, 64, 1) 
  6. normed = norm(image=img, mask=mask) 
  7. img, mask = [normed[x] for x in ['image''mask']] 
  8. def img_to_batch(x): 
  9.  x = np.transpose(x, (2, 0, 1)).astype('float32'
  10.  return torch.from_numpy(np.expand_dims(x, 0)) 
  11. img, mask = map(img_to_batch, (img, mask)) 
  12. criterion = F.binary_cross_entropy 

現(xiàn)在是時(shí)候訓(xùn)練一個(gè)網(wǎng)絡(luò)并對(duì)單個(gè)圖像進(jìn)行過(guò)度擬合了——正如我所提到的,這是一種很好的調(diào)試技術(shù): 

  1. model_a = UNet(3, 1)  
  2. optimizer = torch.optim.Adam(model_a.parameters(), lr=1e-3) 
  3. losses = [] 
  4. for t in tqdm(range(20)): 
  5.  loss = criterion(model_a(img), mask) 
  6.  losses.append(loss.item())  
  7.  optimizer.zero_grad() 
  8.  loss.backward() 
  9.  optimizer.step() 
  10.   
  11. _ = plt.plot(losses)  
8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中常見(jiàn)的Bug

曲率看起來(lái)很好,但是交叉熵的損失值-300是不可預(yù)料的。是什么問(wèn)題?

歸一化處理圖像效果很好,但是mask沒(méi)有:需要手動(dòng)縮放到 [0,1]。 

  1. model_b = UNet(3, 1)  
  2. optimizer = torch.optim.Adam(model_b.parameters(), lr=1e-3) 
  3. losses = [] 
  4. for t in tqdm(range(20)): 
  5.  loss = criterion(model_b(img), mask / 255.) 
  6.  losses.append(loss.item())  
  7.  optimizer.zero_grad() 
  8.  loss.backward() 
  9.  optimizer.step() 
  10.   
  11. _ = plt.plot(losses) 

8個(gè)計(jì)算機(jī)視覺(jué)深度學(xué)習(xí)中常見(jiàn)的Bug 

訓(xùn)練循環(huán)的簡(jiǎn)單運(yùn)行時(shí)斷言(例如 assertmask.max()<=1會(huì)很快檢測(cè)到問(wèn)題。同樣,也可以是單元測(cè)試。

總結(jié)

  • 測(cè)試很有必要
  • 運(yùn)行時(shí)斷言可以用于訓(xùn)練的pipeline;
  • 可視化是一種幸福
  • 復(fù)制粘貼是一種詛咒
  • 沒(méi)有什么是靈丹妙藥,一個(gè)機(jī)器學(xué)習(xí)工程師必須總是小心(或只是受苦)。 

 

責(zé)任編輯:華軒 來(lái)源: 今日頭條
相關(guān)推薦

2019-10-17 09:58:01

深度學(xué)習(xí)編程人工智能

2020-12-15 15:40:18

深度學(xué)習(xí)Python人工智能

2020-12-16 19:28:07

深度學(xué)習(xí)計(jì)算機(jī)視覺(jué)Python庫(kù)

2023-03-28 15:21:54

深度學(xué)習(xí)計(jì)算機(jī)視覺(jué)

2017-11-30 12:53:21

深度學(xué)習(xí)原理視覺(jué)

2020-10-15 14:33:07

機(jī)器學(xué)習(xí)人工智能計(jì)算機(jī)

2020-04-26 17:20:53

深度學(xué)習(xí)人工智能計(jì)算機(jī)視覺(jué)

2021-05-22 23:08:08

深度學(xué)習(xí)函數(shù)算法

2021-03-29 11:52:08

人工智能深度學(xué)習(xí)

2023-11-20 22:14:16

計(jì)算機(jī)視覺(jué)人工智能

2018-09-18 10:55:24

人工智能機(jī)器學(xué)習(xí)深度學(xué)習(xí)

2023-07-07 10:53:08

2019-11-07 11:29:29

視覺(jué)技術(shù)數(shù)據(jù)網(wǎng)絡(luò)

2023-11-01 14:51:21

邊緣計(jì)算云計(jì)算

2017-05-02 21:03:04

深度學(xué)習(xí)幾何學(xué)人工智能

2017-05-02 09:54:03

深度學(xué)習(xí)幾何學(xué)計(jì)算機(jī)

2019-01-11 18:52:35

深度學(xué)習(xí)視覺(jué)技術(shù)人工智能

2021-05-19 09:00:00

人工智能機(jī)器學(xué)習(xí)技術(shù)

2023-04-04 08:25:31

計(jì)算機(jī)視覺(jué)圖片

2024-08-14 17:21:34

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)