λ°°κ²½ λ° μλ¬ λ΄μ©
PyTorchλ‘ μ΄λ―Έμ§λ₯Ό νΈλ€λ§νλ μ€ λ Έμ΄μ¦λ₯Ό μΆκ°νμ¬ augmentation νλ €νλ€
μ΄λ―Έμ§ μ¬μ΄μ¦μ κ°μ νμ€μ κ·λΆν¬ λμ ν μλ‘ λ³νμ λ°μν μλ¬μ΄λ€
img_t.shape
torch.Size([720, 1280, 3])
---
random_noise = torch.randn_like(img_t)
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
/tmp/ipython-input-120581056.py in <cell line: 0>()
----> 1 random_noise = torch.randn_like(img_t)
NotImplementedError: "normal_kernel_cpu" not implemented for 'Byte'
μμΈμ λ°μ΄ν° νμ λΆμΌμΉ
img_t.shape
=> torch.Size([720, 1280, 3])
- img_tλ dtypeμ΄ torch.uint8 (Byte)μΈ μ΄λ―Έμ§ → 0~255 μ μκ°
- torch.randn_likeλ λΆλμμμ ν μ(float)λ₯Ό νμλ‘ ν¨
- uint8μλ normal_kernel_cpuκ° κ΅¬νλμ΄ μμ§ μμμ NotImplementedError λ°μ
μ μν ν μμλ λ°λ‘ randn_likeλ₯Ό μ¬μ©ν μ μλ€
ν΄κ²° λ°©λ²
1. floatμΌλ‘ λ³ν ν noise μμ±
random_noise = torch.randn_like(img_t.float()) # floatμΌλ‘ λ³ν
2. 0~1 λ²μλ‘ μ κ·ν ν noise μμ±
img_float = img_t.float() / 255.0
random_noise = torch.randn_like(img_float)
3. νΉμ dtype μ§μ
random_noise = torch.randn(img_t.shape, dtype=torch.float32)
random_noise = torch.randn_like(img_t, dtype=torch.float)
곡λΆνλ©΄μ λ°μ΄ν° νμ κ³Ό κ΄λ ¨λ μλ¬λ€μ μ’ μ’ λ§μ£Όνλ μ€.
λ°μ΄ν° λ³ν λ° μ μ²λ¦¬ μ λ νμ μ μ£Όμνμ
'μλ¬ λ° μ΄μ' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
| Colab MMDetection μ μ μ΄μ - Colabμμ μ¬μ©x (0) | 2025.12.10 |
|---|---|
| VSCodeμμ C/C++ μ μ μ΄μ (0) | 2025.11.06 |
| [PyTorch] RuntimeError: mat1 and mat2 must have the same dtype, but got Double and Float (0) | 2025.09.03 |
| μλμ°11 μλμ½λ€ ν μνλ‘ GPU μ ν μ μ₯μ© (1) | 2025.07.01 |