From c821a77d759a6ca7127e7dd80af76cc9d9e49a97 Mon Sep 17 00:00:00 2001 From: Zhanpeng Yang Date: Fri, 11 Oct 2024 13:22:41 +0800 Subject: [PATCH] =?UTF-8?q?[Changed]=E5=B0=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index b070fd3..43504f6 100644 --- a/main.py +++ b/main.py @@ -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)