Open Dataset
Data Structure ?
1.65G
Data Structure ?
*The above analysis is the result extracted and analyzed by the system, and the specific actual data shall prevail.
README.md
これは50種類の動物カテゴリーの37322枚の画像から構成されており、各画像には事前に抽出された特徴表現があります。これらのカテゴリーは、オシャーソンの古典的なカテゴリー/属性行列[3,4]に沿っており、各カテゴリーに85個の数値属性値を提供します。共有属性を使用することで、異なるカテゴリー間で情報を伝達することができます。
画像データは2016年に公共のリソース(例えばFlickr)から収集されました。この過程で、無料で使用および再配布できる許可を得た画像のみを含めるようにしました。個々の許可ファイルのアーカイブを参照してください。 ゼロショット学習用のデータセット、50個の動物カテゴリー、85個の属性
ファイル説明:
JPEGImages:動物の画像。サブフォルダ名は動物の名前です。
licenses:あまり役に立たないファイルです。
class.txt:動物のリスト。順序が重要です!!!
predicates.txt:属性のリスト。順序が重要です!!!
predicate - matrix - binary.txt:各行は各動物の属性に対応しています。各行に対応する動物の種類はclass.txtファイルを参照し、各列に対応する属性はpredicates.txtファイルを参照します。二値属性です。
predicate - matrix - binary.txt:各行は各動物の属性に対応しています。各行に対応する動物の種類はclass.txtファイルを参照し、各列に対応する属性はpredicates.txtファイルを参照します。連続属性で、後続のunseenサンプルの分類に使用されます。値は各属性の信頼度で、実際のアプリケーションでは正規化が必要になる場合があります。
testclasses.txt:テストに使用するカテゴリー。
trainclasses.txt:トレーニングに使用するカテゴリー。
実際の使用では、元のデータセットで提供されるデータは使いにくい場合があります。txtファイルをcsvファイルに変換すると使いやすくなります。以下の通りです。
VGG19(ImageNetデータセットで事前学習されたもの)を使用してこのデータセットの特徴抽出を行い、全結合層の倒数第2層の出力を特徴として選択します。次元数は4096次元です。
ソースコードは以下の通りです。
# -*- coding: utf-8 -*-
from keras.applications.vgg19 インポート VGG19
from keras.preprocessing インポート image
from keras.applications.vgg19 インポート preprocess_input
from keras.models インポート Model
インポート os
インポート numpy as np
インポート scipy.io as sio
インポート csv
##ファイルパスのリストdir+filenameを取得する
def get_files():
attribute_path = r"C:\Users\ZhouFengtao\OneDrive\Program\balabalaba\data\attribute.csv"
path = r"D:\AwA2 - data\Animals_with_Attributes2\JPEGImages"
class_list = []
class_num = {}
class_att = {}
image_path = []
image_att = None
attribute_file = csv.reader(open(attribute_path))
# 属性を取得する
print('属性を取得する')
for row in attribute_file:
att = [float(x) for x in row[1:]]
class_att[row[0]] = att
class_num[row[0]] = 0
for root, dirs, files in os.walk(path):
for name in files:
animal = str.split(name, '_')[0]
if animal not in class_list:
class_list.append(animal)
class_num[animal] = class_num[animal] + 1
if image_att is None:
image_att = class_att[animal]
else:
image_att = np.row_stack((image_att, class_att[animal]))
image_path.append(os.path.join(root, name))
return class_list, class_num, class_att, image_path
if __name__ == '__main__':
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '0'
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
ベースモデル = VGG19(weights='imagenet', include_top=True)
model_fc1 = Model(inputs=ベースモデル.input, outputs=ベースモデル.get_layer('fc1').output) # fc1層
class_list, class_num, class_att, image_path = get_files() ##画像パスのリストを取得する
print(class_list)
print(class_num)
print(class_att)
fc1s = None
atts = None
for i, path in enumerate(image_path):
print('番号 ' + str(i) + ' パス: ' + path)
try:
img = image.load_img(path, target_size=(224, 224))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
fc1 = model_fc1.predict(x)
key = str.split(str.split(path, '\\')[-1], '_')[0]
att = class_att[key]
if fc1s is None:
fc1s = fc1
atts = att
else:
fc1s = np.row_stack((fc1s, fc1))
atts = np.row_stack((atts, att))
except IOError:
print('########################画像エラー###########################')
# 抽出した特徴を保存する
sio.savemat('vgg19_feature', {'fc1': fc1s, 'atts': atts})
fw = open("animals_num.txt", 'w+')
fw.write(str(class_num)) # 辞書を文字列に変換する
fw.close()
fw = open("animals_sequence.txt", 'w')
fw.write(str(class_list)) # リストを文字列に変換する
fw.close()
- Share your thoughts
ALL
Data usage instructions: h1>
I. Data Source and Display Explanation:
- 1. The data originates from internet data collection or provided by service providers, and this platform offers users the ability to view and browse datasets.
- 2. This platform serves only as a basic information display for datasets, including but not limited to image, text, video, and audio file types.
- 3. Basic dataset information comes from the original data source or the information provided by the data provider. If there are discrepancies in the dataset description, please refer to the original data source or service provider's address.
II. Ownership Explanation:
- 1. All datasets on this site are copyrighted by their original publishers or data providers.
III. Data Reposting Explanation:
- 1. If you need to repost data from this site, please retain the original data source URL and related copyright notices.
IV. Infringement and Handling Explanation:
- 1. If any data on this site involves infringement, please contact us promptly, and we will arrange for the data to be taken offline.
- 1. The data originates from internet data collection or provided by service providers, and this platform offers users the ability to view and browse datasets.
- 2. This platform serves only as a basic information display for datasets, including but not limited to image, text, video, and audio file types.
- 3. Basic dataset information comes from the original data source or the information provided by the data provider. If there are discrepancies in the dataset description, please refer to the original data source or service provider's address.
- 1. All datasets on this site are copyrighted by their original publishers or data providers.
- 1. If you need to repost data from this site, please retain the original data source URL and related copyright notices.
- 1. If any data on this site involves infringement, please contact us promptly, and we will arrange for the data to be taken offline.