机器视觉的情感判断实践(From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction)

  看到了2017年的一篇文章From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction,对于其里面的视觉中的情感判断,感觉非常有价值,于是就直接利用其提供好的模型进行了测试,感觉效果还是不错。

与传统的文本情感判断一样,机器情感的判断基础框架也是一样,对一张图像给个0,1这样的值,然后进行训练。

机器视觉的情感判断实践(From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction)_第1张图片


如给出的的train数据集的组织格式也是:图像,情感标签(0,1)


其中训练数据集采用的是:https://www.cs.rochester.edu/u/qyou/DeepSent/deepsentiment.html提供的DeepSent数据集。


看了下基本原理,作者主要利用了CaffeNet来作为图像情感分析的基础框架,改进主要如下:

(1)对最后一层进行了改进,即将原始的全联接层修改为两个部分,如下:

the original fully-connectedfc8 layer from CaffeNet is replaced by a two-neuronlayer, fc8 twitter, representing positive and negativesentiment. The weights in this new layer are initializedfrom a zero-mean Gaussian distribution with standarddeviation 0.01 and zero bias.

(2)因为无法描述最后一层对结果的贡献,可以对后面几层都进行实验测试,wherein the last or the two last fully-connectedlayers are removed, denoted as fc6-2 and fc7-2, respectively.


实验测试:主要参照:https://github.com/imatge-upc/sentiment-2017-imavis


下载图像数据集,实践步骤包括两步,一是生成情感语义图,以NPY数据结尾,二是合成情感图片,以图片显示。


其中一些图片的显示效果如下:一般绿的代表正面,红的代表负面。

机器视觉的情感判断实践(From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction)_第2张图片

机器视觉的情感判断实践(From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction)_第3张图片

机器视觉的情感判断实践(From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction)_第4张图片

机器视觉的情感判断实践(From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction)_第5张图片


机器视觉的情感判断实践(From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction)_第6张图片机器视觉的情感判断实践(From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction)_第7张图片

机器视觉的情感判断实践(From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction)_第8张图片

机器视觉的情感判断实践(From Pixels to Sentiment: Fine-tuning CNNs for Visual Sentiment Prediction)_第9张图片

你可能感兴趣的:(visual,sentiment)