首页 > 解决方案 > TensorFlow png as x 和 html as y

问题描述

使用网络上的一些示例,我想出了这个解决方案,到目前为止还没有经过测试。tensorflow 有更多代码

import tensorflow as tf
from tensorflow.keras.layers import Dense, Flatten, Conv2D
from tensorflow.keras import Model
from lxml import html
import requests
import imgkit

tree = [0]*255
trees = [0]*255
for x in xrange(255):
    page = requests.get(html)
    tree[x] = html.fromstring(page.content)

    imgkit.from_url(html, 'out.png')
    trees[x] = tf.io.decode_png(
        'out.png',
        channels=0,
        dtype=tf.dtypes.uint8,
        name=None
    )
# mnist = tf.keras.datasets.mnist
# (x_train, y_train), (x_test, y_test) = mnist.load_data()
(x_train, y_train), (x_test, y_test) = (trees[0:200], tree[0:200]), (trees[200:255], tree[200:255])

其余代码可在此处找到: https ://github.com/YunYang1994/TensorFlow2.0-Examples/blob/master/2-Basical_Models/CNN.py

这是否应该适用于从相似解决方案的给定屏幕截图创建 HTML?

事实证明,您需要导入 JS 和 CSS 才能接近正确的解决方案,然后您将近似为错误的所有将是后端,如果您为此编写代码可能会非常复杂。理想情况下,您只使用已被标记为对“tor”用户安全的网站;javascript 已禁用。

标签: pythontensorflowkeras

解决方案


推荐阅读