我最近将一个宠物项目从 Blazor .NET 3.1 迁移到 .NET 5.0,并尝试切换到使用 css 隔离。
我创建了一个 scss 文件(它使用 webcompiler 扩展编译为一个 css 文件),其前缀与我的组件相同:
我已经在我的 index.html 文件中包含了生成的 css:
<link href="FinNodeWASM.Client.styles.css" rel="stylesheet">
Run Code Online (Sandbox Code Playgroud)
Dotnet 正在正确生成 css 并按预期附加范围标识符属性:

但是,当我查看生成的 HTML 时,我在那里没有看到预期的分数标识符属性:
当我尝试使用简单的模型进行预测时,我得到了以下错误:
在图表中找不到在feed_devices或fetch_devices中指定的张量输入_1:0
在行:
seatbelt_model.predict(image_arr, verbose=1)
Run Code Online (Sandbox Code Playgroud)
在代码中:
from tensorflow import keras
import tensorflow as tf
import numpy as np
graph = tf.get_default_graph()
seatbelt_model = keras.models.load_model(filepath='./graphs/seatbelt_A_3_81.h5')
class SeatbeltPredictor:
INPUT_SHAPE = (-1, 120, 160, 1)
@staticmethod
def predict_seatbelt(image_arr):
with graph.as_default():
image_arr = np.array(image_arr).reshape(SeatbeltPredictor.INPUT_SHAPE)
predicted_labels = seatbelt_model.predict(image_arr, verbose=1)
return predicted_labels
Run Code Online (Sandbox Code Playgroud)
该模型具有以下形状:
input_layer = keras.layers.Input(shape=(IMAGE_HEIGHT, IMAGE_WIDTH, 1))
conv_0 = keras.layers.Conv2D(filters=32, kernel_size=[5, 5], activation=tf.nn.relu, padding="SAME")(input_layer)
pool_0 = keras.layers.MaxPool2D(pool_size=[2, 2], strides=2, padding="VALID")(conv_0)
conv_1 = keras.layers.Conv2D(filters=32, kernel_size=[5, 5], activation=tf.nn.relu, padding="SAME")(pool_0)
pool_1 = keras.layers.MaxPool2D(pool_size=[2, 2], strides=2, padding="VALID")(conv_1)
flat_0 = …Run Code Online (Sandbox Code Playgroud)