mnist

Pytorch自定义层含lambda函数(Lambda层)时保存模型出错的解决方案

好久不见. 提交于 2019-12-23 13:53:14
出错 类型: _pickle.PicklingError: Can't pickle <function < lambda > at 0x0000000018944488>: attribute lookup < lambda > on __main__ failed 详情: File "C:\Users\piantou\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\serialization.py", line 224, in save return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol)) File "C:\Users\piantou\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\serialization.py", line 149, in _with_file_like return body(f) File "C:\Users\piantou\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\serialization

What is the replace for softmax layer in case more than one output can be activated?

强颜欢笑 提交于 2019-12-23 12:32:53
问题 For example, I have CNN which tries to predict numbers from MNIST dataset (code written using Keras). It has 10 outputs, which form softmax layer. Only one of outputs can be true (independently for each digit from 0 to 9): Real: [0, 1, 0, 0, 0, 0, 0, 0, 0, 0] Predicted: [0.02, 0.9, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01] Sum of predicted is equal to 1.0 due to definition of softmax. Let's say I have a task where I need to classify some objects that can fall in several categories: Real

下载MNIST数据集脚本input_data源码

我与影子孤独终老i 提交于 2019-12-23 04:55:44
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ======

CAFFE安装 CentOS无GPU

房东的猫 提交于 2019-12-23 02:19:57
前记 由于是在一台用了很久的机器上安装caffe,过程比较复杂,网上说再干净的机器上装比较简单。如果能有干净的机器,就不用再过这么多坑了,希望大家好运!介绍这里就不说了,直接进入正题: Caffe 主页 http://caffe.berkeleyvision.org/ github主页 https://github.com/BVLC/caffe 机器配置: [root@cdh-nn-182 build]# lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: RedHatEnterpriseServer Description: Red Hat Enterprise Linux Server release 6.3 (Santiago) Release: 6.3gcc 版本 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)Python 2.7.10 python已安装numpy,没有GPU Prerequisites CUDA is

Why (MNIST trained) model is not good at digits which not in the center of the picture

老子叫甜甜 提交于 2019-12-23 02:03:17
问题 About the problem My CNN model has accuracy up to 99.4% on the MNIST dataset. So I try some irregular input. And the predicted result is not correct. The following are some of the irregular input I use As we know, CNN convolution will scan the whole image, also don't care about the key features in which areas of the image. Why CNN could not deal with irregular input 回答1: As we know, CNN convolution will scan the whole image, also don't care about the key features in which areas of the image.

center of mass of pixels in grayscale image

别等时光非礼了梦想. 提交于 2019-12-22 09:34:54
问题 I'm working on a program that lets the user draw a digit in a "scribbling area" and with the press of a button the application will predict the digit that he entered, using a neural net classifier. Now, to train the neural net, I used MNIST database which specifies the following: "images from NIST were size normalized to fit in a 20x20 pixel box while preserving their aspect ratio [...] the images were centered in a 28 x 28 image by computing the center of mass of the pixels". The problem

TensorFlow ValueError: Variable does not exist, or was not created with tf.get_variable()

自作多情 提交于 2019-12-21 02:33:29
问题 I am a newbie to Tensorflow and trying to implement a Generative Adversarial Network. I am following this tutorial for the same in which we are trying to generate MNIST dataset like images using generative models. However, the code seems to be using older version of TensorFlow ( < 1.0 ), because of which it is giving out the following error: line: trainerD = tf.train.AdamOptimizer().minimize(d_loss, var_list=d_vars) ValueError: Variable d_wconv1/Adam/ does not exist, or was not created with

Extract images from .idx3-ubyte file or GZIP via Python

≯℡__Kan透↙ 提交于 2019-12-20 08:59:48
问题 I have created a simple function for facerecognition by using the facerecognizer from OpenCV. It works all fine with images from people. Now I would like to make a test by using handwritten characters instead of people. I came across MNIST dataset, but they store images in a weird file which I have never seen before. I simply need to extract a few images from: train-images.idx3-ubyte and save them in a folder as .gif Or am I missunderstand this MNIST thing. If yes where could I get such a

Convolutional neural network outputting equal probabilities for all labels

给你一囗甜甜゛ 提交于 2019-12-20 04:24:14
问题 I am currently training a CNN on MNIST, and the output probabilities (softmax) are giving [0.1,0.1,...,0.1] as training goes on. The initial values aren't uniform, so I can't figure out if I'm doing something stupid here? I'm only training for 15 steps, just to see how training progresses; even though that's a low number, I don't think that should result in uniform predictions? import numpy as np import tensorflow as tf import imageio from sklearn.datasets import fetch_mldata mnist = fetch

caffe的python接口学习(4):mnist实例---手写数字识别

痞子三分冷 提交于 2019-12-20 01:39:26
深度学习的第一个实例一般都是mnist,只要这个例子完全弄懂了,其它的就是举一反三的事了。由于篇幅原因,本文不具体介绍配置文件里面每个参数的具体函义,如果想弄明白的,请参看我以前的博文: 数据层及参数 视觉层及参数 solver配置文件及参数 一、数据准备 官网提供的mnist数据并不是图片,但我们以后做的实际项目可能是图片。因此有些人并不知道该怎么办。在此我将mnist数据进行了转化,变成了一张张的图片,我们练习就从图片开始。mnist图片数据我放在了百度云盘。 mnist图片数据下载 :http://pan.baidu.com/s/1pLMV4Kz 数据分成了训练集(60000张共10类)和测试集(共10000张10类),每个类别放在一个单独的文件夹里。并且将所有的图片,都生成了txt列表清单(train.txt和test.txt)。大家下载下来后,直接解压到当前用户根目录下就可以了。由于我是在windows下压缩的,因此是winrar文件。如果大家要在linux下解压缩,需要安装rar的linux版本,也是十分简单 sudo apt-get install rar 二、导入caffe库,并设定文件路径 我是将mnist直接放在根目录下的,所以代码如下: # -*- coding: utf-8 -*- import caffe from caffe import layers