小编Nat*_*oen的帖子

如何在同一行中漂亮地打印带有长数组的 json

我想将收集到的数据存储在 json 中,它们都是整数数组,每个数组都有几千个元素。

我希望文件的同一列表中的元素位于同一行,应该看起来像

{
    "foo": [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    ],
    "bar": [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
Run Code Online (Sandbox Code Playgroud)

python json

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

如何在 Tensorflow 中更改保存的模型输入形状?

我想让这个 repo https://github.com/ildoonet/tf-pose-estimation与 Intel Movidius 一起运行,所以我尝试使用 mvNCCompile 转换 pb 模型。

问题是 mvNCCompile 需要固定的输入形状,但我拥有的模型是动态的。

我试过这个

    graph_path = 'models/graph/mobilenet_thin/graph_opt.pb'

    with tf.gfile.GFile(graph_path, 'rb') as f:
        graph_def = tf.GraphDef()
        graph_def.ParseFromString(f.read())

    graph = tf.get_default_graph()
    tf.import_graph_def(graph_def, name='TfPoseEstimator')
    x = graph.get_tensor_by_name('TfPoseEstimator/image:0')
    x.set_shape([1, 368, 368, 3])
    x = graph.get_tensor_by_name('TfPoseEstimator/MobilenetV1/Conv2d_0/Conv2D:0')
    x.set_shape([1, 368, 368, 24])

Run Code Online (Sandbox Code Playgroud)

得到了这个

(<tf.Tensor 'TfPoseEstimator/MobilenetV1/Conv2d_0/weights:0' shape=(3, 3, 3, 24) dtype=float32>,)
(<tf.Tensor 'TfPoseEstimator/image:0' shape=(1, 368, 368, 3) dtype=float32>,)
(<tf.Tensor 'TfPoseEstimator/MobilenetV1/Conv2d_0/Conv2D:0' shape=(1, 368, 368, 24) dtype=float32>,)
(<tf.Tensor 'TfPoseEstimator/MobilenetV1/Conv2d_0/Conv2D_bn_offset:0' shape=(24,) dtype=float32>,)
(<tf.Tensor 'TfPoseEstimator/MobilenetV1/Conv2d_0/BatchNorm/FusedBatchNorm:0' shape=(?, ?, ?, 24) dtype=float32>,)
(<tf.Tensor …
Run Code Online (Sandbox Code Playgroud)

tensorflow

0
推荐指数
1
解决办法
3762
查看次数

标签 统计

json ×1

python ×1

tensorflow ×1