0
0

More than 1 year has passed since last update.

Kaggleの無料データセットの確認 ~toyota_cars~

Posted at

概要

Kaggleで公開されている無料データセットを確認してみた。
AIの開発に使用でき、色々な検討ができそう。

環境

OS: MacOS 13.4.1
DockerDesktop: 4.20.1
python3.8.5

データのダウンロード

以下のサイトからダウンロードする。
https://www.kaggle.com/datasets/occultainsights/toyota-cars-over-20k-labeled-images

またその他にも様々なデータが公開されている。その他のものも今後確認してみる予定。
https://www.kaggle.com/competitions/google-universal-image-embedding/discussion/337384

ダウンロードしたファイルを解凍すると、車種ごとの名前でフォルダ分けされた画像があることが確認できる。

クラス数のカウント

それぞれのフォルダの画像の枚数をカウントし、クラス数を調べる。
Pythonで記述。

check_data.py
import os

def check_data():
    path_input = os.path.join('dataset')
    list_dir = [f for f in os.listdir(path_input) if os.path.isdir(os.path.join(path_input, f))]

    path_save = os.path.join('output', 'dataset_toyota_cars.csv')
    with open(path_save, 'w') as logfile:
        logfile.write('dir_name,file_count\n')
    for dir in list_dir:
        path = os.path.join(path_input, dir)
        list_files = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
        with open(path_save, 'a') as logfile:
            logfile.write('{},{}\n'.format(dir, len(list_files)))

if __name__=='__main__':
    check_data()

結果

各クラス数は以下のようになっていた。

dataset_toyota_cars.csv
dir_name,file_count
4runner,946
alphard,64
avalon,497
avanza,63
avensis,167
aygo,109
camry,2246
celica,101
corolla,2311
corona,70
crown,77
estima,32
etios,74
fortuner,254
hiace,75
highlander,1119
hilux,435
innova,121
iq,27
matrix,63
mirai,57
previa,44
prius,1039
rav4,1786
revo,162
rush,23
sequoia,166
sienna,652
soarer,48
starlet,48
supra,173
tacoma,1318
tundra,1035
venza,122
verso,112
vios,141
vitz,102
yaris,844

最後に

Kaggleで公開されているデータセットを確認してみた。
他のデータセットも今後確認予定。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0