【问题标题】:Tensorflow ValueError: setting an array element with a sequence. Min Max ScalingTensorflow ValueError:使用序列设置数组元素。最小最大缩放
【发布时间】:2018-02-08 08:01:00
【问题描述】:
    png = tf.read_file(filename)
    image = tf.image.decode_png(png, dtype=tf.uint16, channels=1)
    scaler = preprocessing.MinMaxScaler()
    scaled_data = scaler.fit_transform(image)
    depth = tf.cast(depth, tf.float32)

图像是从 csv 文件中读取的。我想规范化数据。 上述方法会引发错误。 有人可以告诉我如何应用 scikit learn MinMax scaling 吗?

【问题讨论】:

    标签: tensorflow scikit-learn


    【解决方案1】:

    你可以使用:

    image = tf.div(
            tf.subtract(
                image,
                tf.reduce_min(image)
                ),
            tf.subtract(
                tf.reduce_max(image),
                tf.reduce_min(image)
                )
            )
    

    【讨论】:

      猜你喜欢
      • 2018-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 2011-06-08
      • 2018-08-04
      相关资源
      最近更新 更多