小编rza*_*atx的帖子

我可以保存散点图的高分辨率图像吗?

我可以设置参数来plotly.graph_objs.go.Scatter3d使图形全屏显示或设置更高的保存分辨率吗?使用内置保存绘图功能时保存的当前分辨率为983x525。我希望至少能达到 1080p。

trans = .6
trace1 = go.Scatter3d(
                    x = cluster0["PC1_3d"],
                    y = cluster0["PC2_3d"],
                    z = cluster0["PC3_3d"],
                    mode = "markers",
                    name = "Cluster 0",
                    marker = dict(color = f'rgba(255, 0, 0, {trans})'),
                    text = None)

trace2 = go.Scatter3d(
                    x = cluster1["PC1_3d"],
                    y = cluster1["PC2_3d"],
                    z = cluster1["PC3_3d"],
                    mode = "markers",
                    name = "Cluster 1",
                    marker = dict(color = f'rgba(0, 0, 204, {trans})'),
                    text = None)

trace3 = go.Scatter3d(
                    x = cluster2["PC1_3d"],
                    y = cluster2["PC2_3d"],
                    z = …
Run Code Online (Sandbox Code Playgroud)

python plotly scatter3d plotly-python

10
推荐指数
1
解决办法
1万
查看次数

获取一个图像目录并调整目录中所有图像的大小

我正在尝试将高分辨率图像转换为更易于机器学习管理的图像。目前,我有代码可以将图像大小调整为我想要的高度和宽度,但是我必须一次处理一张图像,当我只处理 12-24 个图像时,这还不错,但很快我想放大做几百张图像。我正在尝试读取目录而不是单个图像并将新图像保存在新目录中。初始图像可能会有所不同,如 .jpg、.png、.tif 等,但我希望将所有输​​出图像设为 .png,就像我在代码中那样。

import os
from PIL import Image

filename = "filename.jpg"
size = 250, 250
file_parts = os.path.splitext(filename)

outfile = file_parts[0] + '_250x250' + file_parts[1]
try:
    img = Image.open(filename)
    img = img.resize(size, Image.ANTIALIAS)
    img.save(outfile, 'PNG')
except IOError as e:
    print("An exception occured '%s'" %e)
Run Code Online (Sandbox Code Playgroud)

任何有关此问题的帮助将不胜感激。

python image image-resizing python-3.7

5
推荐指数
1
解决办法
1万
查看次数

Tensorflow展示模型总结

我有一个训练并保存模型的 UNet。我想查看模型摘要,但当我使用时,model.summary()Output Shape列被切断,无法看到完整的形状。该模型是在 3D 图像上进行训练的,因此输出应显示(None, shapeX, shapeY, shapeZ, num_features)。如何显示完整的输出形状?

from tensorflow.keras.models import load_model
        
model = load_model('model.h5',compile = False)
model.summary()
Run Code Online (Sandbox Code Playgroud)

模型.summary()

模型

python tensorflow

5
推荐指数
1
解决办法
4877
查看次数