<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # TensorFlow 中的圖像預處理,用于預訓練的 VGG16 我們為 TensorFlow 中的預處理步驟定義一個函數,如下所示: ```py def tf_preprocess(filelist): images=[] for filename in filelist: image_string = tf.read_file(filename) image_decoded = tf.image.decode_jpeg(image_string, channels=3) image_float = tf.cast(image_decoded, tf.float32) resize_fn = tf.image.resize_image_with_crop_or_pad image_resized = resize_fn(image_float, image_height, image_width) means = tf.reshape(tf.constant([123.68, 116.78, 103.94]), [1, 1, 3]) image = image_resized - means images.append(image) images = tf.stack(images) return images ``` 在這里,我們創建 images 變量而不是占位符: ```py images=tf_preprocess([x for x in x_test]) ``` 我們按照與以前相同的過程來定義 VGG16 模型,恢復變量然后運行預測: ```py with slim.arg_scope(vgg.vgg_arg_scope()): logits,_ = vgg.vgg_16(images, num_classes=inet.n_classes, is_training=False ) probabilities = tf.nn.softmax(logits) init = slim.assign_from_checkpoint_fn( os.path.join(model_home, '{}.ckpt'.format(model_name)), slim.get_variables_to_restore()) ``` 我們獲得與以前相同的類概率。我們只是想證明預處理也可以在 TensorFlow 中完成。但是,TensorFlow 中的預處理僅限于 TensorFlow 提供的功能,并將您與框架深深聯系在一起。 我們建議您將預處理管道與 TensorFlow Model Training 和 Predictions 代碼分開。 保持獨立使其具有模塊化并具有其他優勢,例如您可以保存數據以便在多個模型中重復使用。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看