resnet

ResNet for Binary classification- Just 2 values of cross-validation accuracy

随声附和 提交于 2019-12-11 15:32:28
问题 I am new to python and Keras. I am trying to do a binary classification using transfer learning from ResNet. My dataset is very small but I am using image augmentation. My cross-validation accuracy is just either of 2 values 0.3442 and 0.6558 for all images. Can anyone tell me why this happens? Also when I predict (0 or 1), it labels all images as one class(0). Here is my code: from keras.preprocessing.image import ImageDataGenerator, load_img from keras.models import Sequential,Model,load

Train accuracy drops in some epochs

一个人想着一个人 提交于 2019-12-11 03:24:56
问题 I'm training a ResNet (CIFAR-10 dataset) and train accuracy is mostly (in 95% epochs) increasing, but sometimes it drops 5-10% and then it starts increasing again. Here is an example: Epoch 45/100 40000/40000 [==============================] - 50s 1ms/step - loss: 0.0323 - acc: 0.9948 - val_loss: 1.6562 - val_acc: 0.7404 Epoch 46/100 40000/40000 [==============================] - 52s 1ms/step - loss: 0.0371 - acc: 0.9932 - val_loss: 1.6526 - val_acc: 0.7448 Epoch 47/100 40000/40000 [=========

how loss and metric are calculated in cntk

房东的猫 提交于 2019-12-10 21:14:07
问题 I am new to cntk and python. I have created a python program based on TrainResNet_CIFAR10.py to train 4736 of (64x64x3) images and test 2180 images with 4 classes. After train 160 epochs, I got loss = 0.663 and metric = 29.37%. Finished evaluation metric = 18.94%. When I evaluate the train model based on CNTKLibraryCSEvalExamples.cs to test 2180 images, almost all 2180 are classified as one class (second class). My questions are: I assume loss is calculated from cross_entropy_with_softmax(z,

VGGNet、ResNet、Inception和Xception

僤鯓⒐⒋嵵緔 提交于 2019-12-10 00:44:29
简介 VGGNet 2014年。该网络使用3×3卷积核的卷积层堆叠并交替最大池化层,有两个4096维的全连接层,然后是softmax分类器。16和19分别代表网络中权重层的数量。 ResNet 2015年。该网络使用残差模块来组成更复杂的网络(网络中的网络),使用标准随机梯度下降法训练。与VGG相比,ResNet更深,但是由于使用全局平均池操作而不是全连接密集层,所以模型的尺寸更小。 Inception 2015年。该网络使用多个尺度的卷积核提取特征,并在同一模块中同时计算1×1、3×3、5×5卷积,然后将这些滤波器的输出沿通道维度堆叠并传递到下一层。 Inception-v4编写于2016年。 Xception 2016年。该网络是Inception网络的扩展,使用了深度可分离卷积运算。其参数数量与Inception-v3相同,由于更高效地利用模型参数,该网络性能获得提升并在大型图像分类数据集胜过Inception-v3。 来源: CSDN 作者: redfivehit 链接: https://blog.csdn.net/redfivehit/article/details/103464629

Resnet50

删除回忆录丶 提交于 2019-12-08 20:53:36
ResNet在2015年被提出,在ImageNet比赛Classification任务上获得第一名。 因为它“简单与实用”并存, 很多方法都建立在ResNet50或者ResNet101的基础上完成的 , 检测,分割,识别 等领域都纷纷使用ResNet, Alpha zero也使用了ResNet,所以可见ResNet确实很好用。 (https://blog.csdn.net/lanran2/article/details/79057994 ) 1. ResNet意义 随着网络的加深,出现了训练集准确率下降的现象,我们可以确定这不是由于Overfit过拟合造成的(过拟合的情况训练集应该准确率很高);所以作者针对这个问题提出了一种全新的网络,叫深度残差网络,它允许网络尽可能的加深,其中引入了全新的结构如图1; 这里问大家一个问题 残差指的是什么? 其中ResNet提出了两种mapping:一种是identity mapping,指的就是图1中”弯弯的曲线”,另一种residual mapping,指的就是除了”弯弯的曲线“那部分,所以最后的输出是 y=F(x)+xy=F(x)+x identity mapping顾名思义,就是指本身,也就是公式中的xx,而residual mapping指的是“差”,也就是y−xy−x,所以残差指的就是F(x)F(x)部分。 为什么ResNet可以解决

I am not able to import resnet from keras.applications module

南笙酒味 提交于 2019-12-08 16:39:05
问题 I'm unable to import this module import keras.applications.resnet ModuleNotFoundError in () ----> 1 import keras.applications.resnet ModuleNotFoundError: No module named 'keras.applications.resnet' keras resnet link 回答1: Keras team hasn't included resnet, resnet_v2 and resnext in the current module, they will be added from Keras 2.2.5, as mentioned here. For a workaround, you can use keras_applications module directly to import all ResNet, ResNetV2 and ResNeXt models, as given below from

How to use pre-trained models without classes in Tensorflow?

六眼飞鱼酱① 提交于 2019-12-08 11:06:16
问题 I'm trying to use a pretrained network such as tf.keras.applications.ResNet50 but I have two problems: I just want to obtain the top embedding layers at the end of the network, because I don't want to do any image classification. So due to this there is no need for a classes number I think. tf.keras.applications.ResNet50 takes a default parameter 'classes=1000' Is there a way how I can omit this parameter? My input pictures are 128*128*1 pixels and not 224*224*3 What is the best way to fix my

Keras cnn model output shape doesn't match model summary

时光怂恿深爱的人放手 提交于 2019-12-08 10:32:38
问题 I am trying to use the convolution part of ResNet50() model, as this: #generate batches def get_batches(dirname, gen=image.ImageDataGenerator(), shuffle=True, batch_size=4, class_mode='categorical', target_size=(224,224)): return gen.flow_from_directory(dirname, target_size=target_size, class_mode=class_mode, shuffle=shuffle, batch_size=batch_size) trn_batches = get_batches("path_to_dirctory", shuffle=False,batch_size=4) #create model rn_mean = np.array([123.68, 116.779, 103.939], dtype=np

How to split a Keras model, with a non-sequential architecture like ResNet, into sub-models?

杀马特。学长 韩版系。学妹 提交于 2019-12-08 05:09:49
问题 My model is a resnet-152 i wanna cutting it into two submodels and the problem is with the second one i can't figure out how to build a model from an intermediate layer to the output I tried this code from this response and it doesn't work for me here is my code: def getLayerIndexByName(model, layername): for idx, layer in enumerate(model.layers): if layer.name == layername: return idx idx = getLayerIndexByName(resnet, 'res3a_branch2a') input_shape = resnet.layers[idx].get_input_shape_at(0) #

Get ImageNet label for a specific index in the 1000-dimensional output tensor in torch

守給你的承諾、 提交于 2019-12-08 01:50:51
问题 I have the output Tensor of a forward pass for a Facebook implementation of the ResNet model with a cat image. That is a 1000-dimensional Tensor with the classification probabilities. Using torch.topk I can obtain the top-5 probabilities and their indexes in the output tensor. Now I want to see the human-readable labels for those most-probable indexes. I searched online for the list of labels (which apparently are also called sysnets) and only found this: http://image-net.org/challenges/LSVRC