커피 한잔 사주세요😄
*내 게시물은 Stanford Cars에 대해 설명합니다.
StanfordCars()는 아래와 같이 Stanford Cars 데이터세트를 사용할 수 있습니다.
*메모:
data └-stanford_cars |-cars_test_annos_withlabels.mat |-cars_test | └-*.jpg |-cars_train | └-*.jpg └-devkit |-cars_meta.mat |-cars_test_annos.mat |-cars_train_annos.mat |-eval_train.m |-README.txt └-train_perfect_preds.txt
from torchvision.datasets import StanfordCars train_data = StanfordCars( root="data" ) train_data = StanfordCars( root="data", split="train", transform=None, target_transform=None, download=False ) test_data = StanfordCars( root="data", split="test" ) len(train_data), len(test_data) # (8144, 8041) train_data # Dataset StanfordCars # Number of datapoints: 8144 # Root location: data train_data.root # 'data' train_data._split # 'train' print(train_data.transform) # None print(train_data.target_transform) # None train_data.download # <bound method StanfordCars.download of Dataset StanfordCars # Number of datapoints: 8144 # Root location: data> len(train_data.classes), train_data.classes # (196, # ['AM General Hummer SUV 2000', 'Acura RL Sedan 2012', 'Acura TL Sedan 2012', # 'Acura TL Type-S 2008', ..., 'Volvo 240 Sedan 1993', # 'Volvo XC90 SUV 2007', 'smart fortwo Convertible 2012']) train_data[0] # (<PIL.Image.Image image mode=RGB size=600x400>, 13) train_data[1] # (<PIL.Image.Image image mode=RGB size=900x675>, 2) train_data[2] # (<PIL.Image.Image image mode=RGB size=640x480>, 90) train_data[3] # (<PIL.Image.Image image mode=RGB size=2100x1386>, 133) train_data[4] # (<PIL.Image.Image image mode=RGB size=144x108>, 105) import matplotlib.pyplot as plt def show_images(data, main_title=None): plt.figure(figsize=(12, 5)) plt.suptitle(t=main_title, y=1.0, fontsize=14) for i, (im, lab) in zip(range(1, 11), data): plt.subplot(2, 5, i) plt.imshow(X=im) plt.title(label=lab) plt.tight_layout() plt.show() show_images(data=train_data, main_title="train_data") show_images(data=test_data, main_title="test_data") show_images(data=train_data, ims=train_ims, main_title="train_data") show_images(data=train_data, ims=val_ims, main_title="val_data") show_images(data=test_data, ims=test_ims, main_title="test_data")
위 내용은 PyTorch의 스탠포드 자동차의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!