INNER CODE UNIT · Python

img_array

WISEPLAT/Hackathon-Finam-NN-Trade-Robot · 4_check_predictions_by_neural_network.py:43

        img_array = img_to_array(img)  # https://www.tensorflow.org/api_docs/python/tf/keras/utils/img_to_array
        # print(img_array.shape)
        img_array = np.expand_dims(img_array, axis=0)
        # print(img_array.shape)
        _predict = model.predict(img_array, verbose=0)
        _class = 0
        if _predict[0][1] >= 0: _class = 1
        print(f"For image: {_path0}\{_img} Predicted: {_predict} => class={_class}")

    for _img in images_class_1:
        img = Image.open(os.path.join(_path1, _img))
        # отправляем картинку в нейросеть
        img_array = img_to_array(img)  # https://www.tensorflow.org/api_docs/python/tf/keras/utils/img_to_array
        # print(img_array.shape)
        img_array = np.expand_dims(img_array, axis=0)
        # print(img_array.shape)
        _predict = model.predict(img_array, verbose=0)
        _class = 0

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…