VGG16、1000クラス分類データダウンロード
InceptionResNetVer.2、1000クラス分類データダウンロード
##################################
top5 <- function(obj, j, new=F){
if(new) j <- j - 200
o <- order(obj[j,], decreasing=T)
obj[j,o[1:5]]
}
####################################
classname <- read.table("classname.csv") # 1000クラスの名前
# 学生生活写真1000クラス分類結果読み込み
# VGG16
life18_vgg16 <- t(read.table("life18_vgg16.txt", sep=","))
dim(life18_vgg16)
# InceptionResNetVer.2
life18_incepresnet <- t(read.table("life18_inceptionresnet.txt", sep=","))
colnames(life18_vgg16) <- colnames(life18_incepresnet) <- classname[,1]
rownames(life18_vgg16) <- rownames(life18_incepresnet) <- 201:247
j=229
top5(life18_vgg16, j, new=T)
top5(life18_incepresnet, j, new=T)
# VGG16による1000クラス分類による写真間の距離
vgg16.Dist <- as.matrix(dist(rbind(life_vgg16,life18_vgg16), method="manhattan", diag=T, upper=T))
# 写真間距離からの多次元尺度法(MDS)
vgg16.cmd <- cmdscale(vgg16.Dist, k=4, eig=T, add=T)
colnames(vgg16.cmd$points) <- paste("MDS", 1:4, sep="")
# 写真MDS配置
com <- c(1,2) # MDS1, MDS2 軸で表示
colnames(vgg16.cmd$points) <- paste("MDS", 1:4, sep="")
x <- vgg16.cmd$points
plot(x[,com], type="n")
text(x[1:200,com], rownames(x)[1:200], cex=0.8)
text(x[201:247,com], rownames(x)[201:247], cex=0.8, col="red")