[Changed]小修改

This commit is contained in:
Zhanpeng Yang 2024-10-11 13:22:41 +08:00
parent d328231d5c
commit c821a77d75

15
main.py
View File

@ -26,7 +26,10 @@ def register():
data=msgpack.unpackb(gzip.decompress(request.data) )
# print(len(data["c"]),data["c"])
data=np.frombuffer(data["spectral_data_bin"],dtype=np.uint16).reshape(1,1,224,512)
data=np.frombuffer(data["spectral_data_bin"],dtype=np.uint16).reshape(int(len(data["spectral_data_bin"])/224/512/2),1,224,512)
data=np.mean(data,axis=0, keepdims=True)
# print(data.shape)
# input_data=torch.tensor(data,dtype=torch.float32)/4095
@ -38,8 +41,14 @@ def register():
print(output)
response={}
response["temp"]= float(output[0,0]*(1692-1516)+1516)
response["C"]= float(output[0,1]*(0.915-0.062)+0.062)
response["Temperature"]= float(output[0,0]*(1663-1496)+1496)
response["C"]= float(output[0,1]*(0.829-0.079)+0.079)
response["P"]=float(output[0,1]*(0.797-0.001)+0.001)
response["S"]=0.04402615384615385
response["Mn"]=0.138787
response["Ni"]=0.035104
response["Mo"]=0.093789
response["Cr"]=0.002983
d=gzip.compress(msgpack.packb(response))
print(d)