在pycharm中使用display.Image时我看不到图像

时间:2018-05-19 17:10:43

标签: pycharm ipython caffe2

// Imports required
import java.util.Base64
import java.io.ByteArrayInputStream;
import java.io.File;
import javax.imageio.ImageIO;

String imageData = "data:image/png;base64,iVBORw0KGgoAAAANSUhE....";
String base64Data = imageData.split(",")[1]

byte[] decodedBytes = Base64.getDecoder().decode(base64Data);
ByteArrayInputStream bis = new ByteArrayInputStream(decodedBytes);
BufferedImage image = ImageIO.read(bis);

File outputFile = new File("output.png");
ImageIO.write(image, "png", outputFile);    

当我测试caffe2时,我使用上面的代码来查看网络结构。但它没有显示图像。这就是我得到的。 workspace.SwitchWorkspace("net_test", True) print("Current blobs in the workspace: {}".format(workspace.Blobs())) net = core.Net("my_first_net") print("Current network proto:\n{}".format(net.Proto())) X = net.GaussianFill([], ["X"], mean=0.0, std=1.0, shape=[2, 3], run_once=0) print("New network proto:\n{}".format(net.Proto())) W = net.GaussianFill([], ["W"], mean=0.0, std=1.0, shape=[5, 3], run_once=0) b = net.ConstantFill([], ["b"], shape=[5, ], value=1.0, run_once=0) Y = net.FC([X, W, b], ["Y"]) print("Current network proto:\n\n{}".format(net.Proto())) graph = net_drawer.GetPydotGraph(net, rankdir="LR") display.Image(graph.create_png(), width=800) 那么我怎样才能获得图像?顺便说一句,我使用PyCharm和iPython来执行它。

0 个答案:

没有答案