import tensorflow as tf
sess = tf.Session()
def add_to_batch(image):
print('Adding to batch')
image_batch = tf.train.shuffle_batch([image],batch_size=5,capacity=11,min_after_dequeue=1,num_threads=1)
# Add to summary
tf.image_summary('images',image_batch)
return image_batch
def get_batch():
# Create filename queue of images to read
filenames = [('/media/jessica/Jessica/TensorFlow/Practice/unlabeled_data_%d.png' % i) for i in range(11)]
filename_queue = tf.train.string_input_producer(filenames)
reader = tf.WholeFileReader()
key, value = reader.read(filename_queue)
# Read and process image
my_image = tf.image.decode_png(value)
my_image_float = tf.cast(my_image,tf.float32)
image_mean = tf.reduce_mean(my_image_float)
my_noise = tf.random_normal([96,96,3],mean=image_mean)
my_image_noisy = my_image_float + my_noise
print('Reading images')
return add_to_batch(my_image_noisy)
def main (): …Run Code Online (Sandbox Code Playgroud) 介绍
我正在使用Tensorflow教程"Deep MNIST for experts"的修改版本,使用Python API进行使用卷积网络的医学图像分类项目.
我想通过对训练集的图像进行随机修改来人为地增加训练集的大小.
问题
当我运行这条线时:
flipped_images = tf.image.random_flip_left_right(images)
Run Code Online (Sandbox Code Playgroud)
我得到了以下错误:
AttributeError:'numpy.ndarray'对象没有属性'get_shape'
我的Tensor"图像"是(shape=[batch, im_size, im_size, channels])"批量"ndarray的ndarray (shape=[im_size, im_size, channels]).
只是为了检查我的输入数据是否以正确的形状和类型打包,我试图在(未修改的)教程"Tensorflow Mechanics 101"中应用这个简单的函数,我得到了同样的错误.
最后,我仍然在尝试使用以下函数时遇到同样的错误:
tf.image.random_flip_up_down() tf.image.random_brightness()tf.image.random_contrast()问题
由于输入数据通常在Tensorflow中作为ndarrays传输,我想知道:
tf.image.random_flip_left_right我的训练集?我使用以下代码创建了一个模型:
# Deep Learning
# In[25]:
from __future__ import print_function
import numpy as np
import tensorflow as tf
from six.moves import cPickle as pickle
from six.moves import range
# In[37]:
pickle_file = 'notMNIST.pickle'
with open(pickle_file, 'rb') as f:
save = pickle.load(f)
train_dataset = save['train_dataset']
train_labels = save['train_labels']
valid_dataset = save['valid_dataset']
valid_labels = save['valid_labels']
test_dataset = save['test_dataset']
test_labels = save['test_labels']
del save # hint to help gc free up memory
print('Training set', train_dataset.shape, train_labels.shape)
print('Validation set', valid_dataset.shape, valid_labels.shape)
print('Test set', test_dataset.shape, …Run Code Online (Sandbox Code Playgroud) 我试图让文件管理员上传多个文件,但不知道如何做到这一点。
目前在下面的参考中,我一次只能上传一个文件。
https://github.com/flask-admin/flask-admin/blob/master/examples/file/app.py
(文件的新链接:https : //github.com/mrjoes/flask-admin/blob/主/示例/文件/app.py )
我尝试更新 html 模板,multiple=""但这并没有帮助上传多个文件。
进一步研究这个我认为这个 html 文件需要有 multiple=""
Python27\Lib\site-packages\flask_admin\templates\bootstrap3\adminC:\Python27\Lib\site-packages\flask_admin\templates\bootstrap3\admin\lib.html
尽管我不确定在何处/如何添加此标签而不实际覆盖源文件。
我遇到以下问题。我想实现一个网络爬虫,到目前为止,它可以工作,但速度太慢,所以我尝试使用多重处理来获取 URL。不幸的是我在这个领域不是很有经验。经过一番阅读后,我认为最简单的方法是使用map来自的方法multiprocessing.pool。
但我不断收到以下错误:
TypeError: Pickling an AuthenticationString object is disallowed for security reasons
Run Code Online (Sandbox Code Playgroud)
我发现很少有同样错误的案例,不幸的是它们并没有帮助我。
我创建了代码的精简版本,它可以重现该错误:
import multiprocessing
class TestCrawler:
def __init__(self):
self.m = multiprocessing.Manager()
self.queue = self.m.Queue()
for i in range(50):
self.queue.put(str(i))
self.pool = multiprocessing.Pool(6)
def mainloop(self):
self.process_next_url(self.queue)
while True:
self.pool.map(self.process_next_url, (self.queue,))
def process_next_url(self, queue):
url = queue.get()
print(url)
c = TestCrawler()
c.mainloop()
Run Code Online (Sandbox Code Playgroud)
我将非常感谢任何帮助或建议!
python queue multiprocessing python-3.x python-multiprocessing
我在安装模块matplotlib并编写以下代码时遇到了这个问题:
import matplotlib.pyplot as plt
Run Code Online (Sandbox Code Playgroud)
然后是错误:
"matplotlib.cbook.TimeoutError: LOCKERROR: matplotlib is trying to acquire the lock
'C:\\Users\\??????\\.matplotlib\\.matplotlib_lock-*'
and has failed. This maybe due to any other process holding this
lock. If you are sure no other matplotlib process is running try
removing these folders and trying again."
Run Code Online (Sandbox Code Playgroud)
因此,当然,如果不能导入它就不能使用。
我正在尝试添加 cssnano 优化规则,但是使用 vue-cli,它似乎不起作用。我在中添加了以下脚本vue.config.js:
module.exports = {
css: {
loaderOptions: {
postcss: {
plugins: [
require("cssnano")({
preset: [
"default",
{
discardComments: {
removeAll: true
},
mergeRules: true
}
]
})
]
}
}
}
};
Run Code Online (Sandbox Code Playgroud)
但它不起作用(见下面的截图)
屏幕截图 - cssnanomergeRules不适用:
我错过了什么?
到目前为止,这有效:
http://JENKINS_SERVER/job/YOUR_JOB_NAME/buildWithParameters?myparam=Hello
Run Code Online (Sandbox Code Playgroud)
但是当值的myparam包含空格,就像Hello word它不工作:
myparam=Hello word
Run Code Online (Sandbox Code Playgroud)
全线:
http://JENKINS_SERVER/job/YOUR_JOB_NAME/buildWithParameters?myparam=Hello world
Run Code Online (Sandbox Code Playgroud)
如何传递此参数值?
我是 oracle 的新手,我有一个 oracle 数据库的 docker 映像,我可以运行它,这是输出:
[root@ip-10-0-20-67 ~]# docker logs -f hungry_keller
ls: cannot access /u01/app/oracle/oradata: No such file or directory
Database not initialized. Initializing database.
Starting tnslsnr
Copying database files
1% complete
3% complete
11% complete
18% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log …Run Code Online (Sandbox Code Playgroud) 我使用groups参数遇到了这个PyTorch 示例,用于深度可分离卷积:
class depthwise_separable_conv(nn.Module):
def __init__(self, nin, nout):
super(depthwise_separable_conv, self).__init__()
self.depthwise = nn.Conv2d(nin, nin, kernel_size=3, padding=1, groups=nin)
self.pointwise = nn.Conv2d(nin, nout, kernel_size=1)
def forward(self, x):
out = self.depthwise(x)
out = self.pointwise(out)
return out
Run Code Online (Sandbox Code Playgroud)
我之前没有在 CNN 中看到任何组的使用。就这一点而言,文档也有点稀疏:
groups控制输入和输出之间的连接。in_channels并且out_channels都必须可以被组整除。
所以我的问题是:
(我想这更笼统,而不是 PyTorch 特定的。)
python ×3
tensorflow ×3
cssnano ×1
database ×1
docker ×1
flask ×1
flask-admin ×1
jenkins ×1
matplotlib ×1
numpy ×1
oracle ×1
python-2.7 ×1
python-3.x ×1
pytorch ×1
queue ×1
vue-cli ×1
vue-cli-3 ×1
vue.js ×1
webpack ×1