我正在尝试编写一个脚本,允许我绘制一个数字图像,然后确定在MNIST上训练的模型的数字.
这是我的代码:
import random
import image
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
import numpy as np
import scipy.ndimage
mnist = input_data.read_data_sets( "MNIST_data/", one_hot=True )
x = tf.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
y = tf.nn.softmax(tf.matmul(x, W) + b)
y_ = tf.placeholder(tf.float32, [None, 10])
cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1]))
train_step = tf.train.GradientDescentOptimizer(0.5).minimize (cross_entropy)
init = tf.initialize_all_variables()
sess = tf.Session()
sess.run(init)
for i in range( 1000 ):
batch_xs, batch_ys = mnist.train.next_batch( 1000 )
sess.run(train_step, feed_dict= …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行此示例 Firebase项目,但在浏览器控制台中始终出现此错误。
Lf {code: "auth/unauthorized-domain", message: "This domain (mail-demo-fcm.firebaseapp.com) is not…se console -> Auth section -> Sign in method tab."}
code: "auth/unauthorized-domain"
message: "This domain (mail-demo-fcm.firebaseapp.com) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab."
Run Code Online (Sandbox Code Playgroud)
我已在身份验证->登录方法中启用了Google作为登录提供程序。
我想念什么吗?
一点指南会有所帮助。
我正在使用Firebase的免费计划。
我有2个模型CustomUser和Magazine,它们具有随机/唯一子弹字段。现在,我要创建一个第三模型(Article),该模型具有到slug字段的外键:
class CustomUser(AbstractBaseUser):
slug = RandomSlugField(length=6, unique=True)
...
class Magazine(models.Model):
slug = RandomSlugField(length=6, unique=True)
name = models.CharField()
class Article(models.Model):
magazine = models.ForeignKey(Magazine, to_field='slug')
author = models.ForeignKey(settings.AUTH_USER_MODEL, to_field='slug')
Run Code Online (Sandbox Code Playgroud)
但是,当我迁移数据库以创建Article模型时,出现以下错误:
django.core.exceptions.FieldDoesNotExist: CustomUser has no field named 'slug'
Run Code Online (Sandbox Code Playgroud)
但是CustomUser显然有一个名为“ slug”的字段。
对于Magazine模型,我不会收到此错误。有谁知道出什么问题了吗?
我将此包用于slug字段:https : //github.com/mkrjhnsn/django-randomslugfield
编辑:这是完整的CustomUser模型:
class CustomUser(AbstractBaseUser, PermissionsMixin):
slug = RandomSlugField(length=6, exclude_upper=True)
username = models.CharField(
_('username'), max_length=30,
help_text=_('Required. 30 characters or fewer.'
'Letters, digits and '
'@/./+/-/_ only.'),
validators=[
validators.RegexValidator(r'^[\w.@+-]+$',
_('Enter a valid username.'), 'invalid')
]) …Run Code Online (Sandbox Code Playgroud) 另一个样本
另一个样本
上面的图像是另一张图片的输出,我试图从中提取所有数字.我正在单独选择每个数字,执行图像变换(阈值处理,图像对比,平均然后对比),似乎没有提供可靠和强大的输出.
使用阈值处理效果很好,但提取的数字的亮度并不总是相同,因此需要调整阈值以使其准确.我需要一些每次都能发挥作用的东西.我正在寻找的输出类似于下图.执行图像转换后,图像通过Tesseract OCR运行.当通过Tesseract放置下面的图像等时,输出几乎总是正确的.
此外,并非所有数字都相同.无论数字的大小,我都需要这个.有人可以帮忙吗?
我需要margins参数将电子表格导出为pdf.
以下参数运行良好.但是我在烧烤后找不到边距参数.
var url_ext = 'exportFormat=pdf&format=pdf' // export as pdf / csv / xls / xlsx
+ '&size=A4' // paper size legal / letter / A4
+ '&portrait=false' // orientation, false for landscape
+ '&fitw=true&source=labnol' // fit to page width, false for actual size
+ '&sheetnames=false&printtitle=false' // hide optional headers and footers
+ '&pagenumbers=false&gridlines=false' // hide page numbers and gridlines
+ '&fzr=false' // do not repeat row headers (frozen rows) on each page
+ '&gid='; // the sheet's Id
Run Code Online (Sandbox Code Playgroud) 当我构建netcore 2.0项目时,VS2017在中\bin\DEBUG\netcoreapp2.0\*而不是中生成文件\bin\DEBUG\*。
由于生成的应用程序在\bin\DEBUG\文件夹中运行,因此在调试时具有幻影效果。
因此,我要加载的config.json文件应该位于\bin\DEBUG\文件夹中,也应该位于模块文件夹中。
更糟糕的是,我的模块也是netcore项目,它们的输出文件夹也位于*中\netcoreapp2.0。
我发现每次构建项目时都很难手动复制它们。
有什么办法可以在netcoreapp2.0上更改TargetDir?(没有构建后命令)
keytool -exportcert -alias androiddebugkey -keystore(您的密钥库路径)\debug.keystore | (您的 OpenSSL 路径)\openssl sha1 -binary | (您的 OpenSSL 路径)\openssl base64)
如何在应用程序中获取用于登录 Facebook 的密钥哈希。which java bin path 选择程序文件或程序文件(x86)。