Computer >> 컴퓨터 >  >> 프로그램 작성 >> Python

Tensorflow와 Python을 사용하여 CIFAR 데이터 세트를 확인하는 방법은 무엇입니까?

<시간/>

CIFAR 데이터셋은 콘솔에서 데이터셋에 있는 이미지를 플로팅하여 확인할 수 있습니다. CIFAR 레이블은 배열이므로 추가 색인이 필요합니다. 'matplotlib' 라이브러리의 'imshow' 메서드를 사용하여 이미지를 표시합니다.

자세히 알아보기: TensorFlow란 무엇이며 Keras가 TensorFlow와 함께 신경망을 생성하는 방법은 무엇입니까?

Google Colaboratory를 사용하여 아래 코드를 실행하고 있습니다. Google Colab 또는 Colaboratory는 브라우저를 통해 Python 코드를 실행하는 데 도움이 되며 구성이 필요 없고 GPU(그래픽 처리 장치)에 대한 무료 액세스가 필요합니다. Colaboratory는 Jupyter Notebook을 기반으로 구축되었습니다.

print("Verifying the data")
plt.figure(figsize=(10,10))
print("Plot the first 15 images")
print("An extra index is needed since CIFAR labels are arrays")
for i in range(15):
   plt.subplot(5,5,i+1)
   plt.xticks([])
   plt.yticks([])
   plt.grid(False)
   plt.imshow(train_images[i], cmap=plt.cm.binary)
   plt.xlabel(class_names[train_labels[i][0]])
plt.show()

코드 크레딧:https://www.tensorflow.org/tutorials/images/cnn

출력

Verifying the data
Plot the first 15 images
An extra index is needed since CIFAR labels are arrays

설명

  • 정규화된 데이터를 시각화합니다.
  • 이 작업은 'matplotlib' 라이브러리를 사용하여 수행됩니다.