假设我以这种方式定义了一个数据集:
filename_dataset = tf.data.Dataset.list_files("{}/*.png".format(dataset))
Run Code Online (Sandbox Code Playgroud)
如何获取数据集中的元素数量(因此,构成一个纪元的单个元素的数量)?
我知道tf.data.Dataset已经知道数据集的维度,因为该repeat()方法允许在指定的时期内重复输入管道。因此,它必须是获取此信息的一种方法。
我正在使用docker-compose.
我的docker-compose.yml看起来像
redis:
image: redis
expose:
- "6379"
volumes:
- ./redis:/data
nerdzcrush:
image: nerdzeu/docker-nerdzcrush
ports:
- "8181:81"
links:
- redis
volumes:
- ./mediacrush:/home/mediacrush
Run Code Online (Sandbox Code Playgroud)
当我运行docker-compose up一切正常.
之后,我需要更改装载路径.我停止了容器docker-compose stop,我用这种方式改变了我的docker-compose.yml:
redis:
image: redis
expose:
- "6379"
volumes:
- ./nerdzcrush/redis:/data
nerdzcrush:
image: nerdzeu/docker-nerdzcrush
ports:
- "8181:81"
links:
- redis
volumes:
- ./nerdzcrush/mediacrush:/home/mediacrush
Run Code Online (Sandbox Code Playgroud)
我删除了旧目录
sudo rm -rf ./mediacrush ./redis
Run Code Online (Sandbox Code Playgroud)
在那之后,我开始使用容器 docker-compose up -d
我希望容器开始使用新路径,但我看到使用了旧路径.因此,我的文件夹中又有./mediacrush和./redis.
这是我对docker-compose错误理解的东西,或者是docker-compose的问题?
我正在使用docker-compose版本:1.5.0dev
谢谢
就稳定性而言,它们之间是否存在任何区别,哪一个是最新的等等。此外,在接下来的几个月中,我应该期待Beta版本吗?然后最终发布?
使用下面的代码,我使用OpenCV和Tensorflow读取相同的图像.
import tensorflow as tf
import cv2
def get_image(image_path):
"""Reads the jpg image from image_path.
Returns the image as a tf.float32 tensor
Args:
image_path: tf.string tensor
Reuturn:
the decoded jpeg image casted to float32
"""
return tf.image.convert_image_dtype(
tf.image.decode_jpeg(
tf.read_file(image_path), channels=3),
dtype=tf.uint8)
path = "./images/2010_006748.jpg"
original_image = cv2.imread(path)
image_tensor = get_image(tf.constant(path))
# convert to uint8
image_tensor = tf.image.convert_image_dtype(image_tensor, dtype=tf.uint8)
with tf.Session() as sess:
image = sess.run(image_tensor)
cv2.imshow("tf", image)
cv2.imshow("original", original_image)
cv2.waitKey(0)
Run Code Online (Sandbox Code Playgroud)
正如你可以从图片看,疗法是通过OpenCV的(正确的颜色)和Tensorflow(错误的颜色)读取图像之间的差异.
我尝试使用Tensorflow图像的颜色进行标准化,cv2.normalize(image, image, 0, 255, cv2.NORM_MINMAX, dtype=cv2.CV_8UC3)但没有任何改变.
我还尝试将图像读取为 …