Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- app.py +174 -220
- app_moe.py +89 -182
- moe_evaluation_results.json +701 -701
- requirements.txt +7 -7
app.py
CHANGED
@@ -6,96 +6,21 @@ import gradio as gr
|
|
6 |
import torchaudio
|
7 |
import torchvision
|
8 |
import spaces
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# Add parent directory to path to import preprocess functions
|
12 |
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
13 |
|
14 |
-
# Import functions from
|
15 |
-
from
|
16 |
-
from evaluate_backbones import WatermelonModelModular, IMAGE_BACKBONES, AUDIO_BACKBONES
|
17 |
-
|
18 |
-
# Define the top-performing models based on evaluation
|
19 |
-
TOP_MODELS = [
|
20 |
-
{"image_backbone": "efficientnet_b3", "audio_backbone": "transformer"},
|
21 |
-
{"image_backbone": "efficientnet_b0", "audio_backbone": "transformer"},
|
22 |
-
{"image_backbone": "resnet50", "audio_backbone": "transformer"}
|
23 |
-
]
|
24 |
-
|
25 |
-
# Define the MoE Model
|
26 |
-
class WatermelonMoEModel(torch.nn.Module):
|
27 |
-
def __init__(self, model_configs, model_dir="models", weights=None):
|
28 |
-
"""
|
29 |
-
Mixture of Experts model that combines multiple backbone models.
|
30 |
-
|
31 |
-
Args:
|
32 |
-
model_configs: List of dictionaries with 'image_backbone' and 'audio_backbone' keys
|
33 |
-
model_dir: Directory where model checkpoints are stored
|
34 |
-
weights: Optional list of weights for each model (None for equal weighting)
|
35 |
-
"""
|
36 |
-
super(WatermelonMoEModel, self).__init__()
|
37 |
-
self.models = []
|
38 |
-
self.model_configs = model_configs
|
39 |
-
|
40 |
-
# Load each model
|
41 |
-
for config in model_configs:
|
42 |
-
img_backbone = config["image_backbone"]
|
43 |
-
audio_backbone = config["audio_backbone"]
|
44 |
-
|
45 |
-
# Initialize model
|
46 |
-
model = WatermelonModelModular(img_backbone, audio_backbone)
|
47 |
-
|
48 |
-
# Load weights
|
49 |
-
model_path = os.path.join(model_dir, f"{img_backbone}_{audio_backbone}_model.pt")
|
50 |
-
if os.path.exists(model_path):
|
51 |
-
print(f"\033[92mINFO\033[0m: Loading model {img_backbone}_{audio_backbone} from {model_path}")
|
52 |
-
model.load_state_dict(torch.load(model_path, map_location='cpu'))
|
53 |
-
else:
|
54 |
-
print(f"\033[91mERR!\033[0m: Model checkpoint not found at {model_path}")
|
55 |
-
continue
|
56 |
-
|
57 |
-
model.eval() # Set to evaluation mode
|
58 |
-
self.models.append(model)
|
59 |
-
|
60 |
-
# Set model weights (uniform by default)
|
61 |
-
if weights:
|
62 |
-
assert len(weights) == len(self.models), "Number of weights must match number of models"
|
63 |
-
self.weights = weights
|
64 |
-
else:
|
65 |
-
self.weights = [1.0 / len(self.models)] * len(self.models) if self.models else [1.0]
|
66 |
-
|
67 |
-
print(f"\033[92mINFO\033[0m: Loaded {len(self.models)} models for MoE ensemble")
|
68 |
-
print(f"\033[92mINFO\033[0m: Model weights: {self.weights}")
|
69 |
-
|
70 |
-
def to(self, device):
|
71 |
-
"""
|
72 |
-
Override to() method to ensure all sub-models are moved to the same device
|
73 |
-
"""
|
74 |
-
for model in self.models:
|
75 |
-
model.to(device)
|
76 |
-
return super(WatermelonMoEModel, self).to(device)
|
77 |
-
|
78 |
-
def forward(self, mfcc, image):
|
79 |
-
"""
|
80 |
-
Forward pass through the MoE model.
|
81 |
-
Returns the weighted average of all model outputs.
|
82 |
-
"""
|
83 |
-
if not self.models:
|
84 |
-
print(f"\033[91mERR!\033[0m: No models available for inference!")
|
85 |
-
return torch.tensor([0.0], device=mfcc.device)
|
86 |
-
|
87 |
-
outputs = []
|
88 |
-
|
89 |
-
# Get outputs from each model
|
90 |
-
with torch.no_grad():
|
91 |
-
for i, model in enumerate(self.models):
|
92 |
-
output = model(mfcc, image)
|
93 |
-
# print the output value
|
94 |
-
print(f"\033[92mDEBUG\033[0m: Model {i} output: {output}")
|
95 |
-
outputs.append(output * self.weights[i])
|
96 |
-
|
97 |
-
# Return weighted average
|
98 |
-
return torch.sum(torch.stack(outputs), dim=0)
|
99 |
|
100 |
# Modified version of process_audio_data specifically for the app to handle various tensor shapes
|
101 |
def app_process_audio_data(waveform, sample_rate):
|
@@ -151,147 +76,203 @@ def app_process_audio_data(waveform, sample_rate):
|
|
151 |
print(traceback.format_exc())
|
152 |
return None
|
153 |
|
154 |
-
#
|
|
|
|
|
|
|
155 |
@spaces.GPU
|
156 |
-
def predict_sugar_content(audio, image,
|
157 |
-
"""Function with GPU acceleration to predict watermelon sugar content in Brix
|
158 |
try:
|
159 |
-
#
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
# Handle different audio input formats
|
170 |
-
if isinstance(audio, tuple) and len(audio)
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
elif isinstance(audio, str):
|
|
|
173 |
audio_data, sample_rate = torchaudio.load(audio)
|
|
|
174 |
else:
|
175 |
return f"Error: Unsupported audio format. Got {type(audio)}"
|
176 |
|
177 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
if isinstance(audio_data, np.ndarray):
|
|
|
|
|
179 |
audio_tensor = torch.tensor(audio_data).float()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
else:
|
|
|
181 |
audio_tensor = audio_data.float()
|
182 |
|
183 |
-
|
|
|
|
|
184 |
mfcc = app_process_audio_data(audio_tensor, sample_rate)
|
185 |
-
if mfcc is None
|
186 |
-
return "Error: Failed to process audio input"
|
187 |
|
188 |
-
#
|
189 |
if isinstance(image, np.ndarray):
|
190 |
-
|
|
|
|
|
|
|
191 |
elif isinstance(image, str):
|
192 |
-
|
|
|
|
|
193 |
else:
|
194 |
return f"Error: Unsupported image format. Got {type(image)}"
|
195 |
|
|
|
|
|
|
|
|
|
196 |
image_tensor = image_tensor.float()
|
197 |
processed_image = process_image_data(image_tensor)
|
198 |
-
if processed_image is None
|
199 |
-
return "Error: Failed to process image input"
|
200 |
|
201 |
-
# Add batch dimension and move to device
|
202 |
-
mfcc
|
203 |
-
|
|
|
204 |
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
prediction = brix_value.item()
|
209 |
-
print(f"\033[92mDEBUG\033[0m: Raw prediction: {prediction}")
|
210 |
-
|
211 |
-
# Ensure prediction is within reasonable bounds (e.g., 6-13 Brix)
|
212 |
-
prediction = max(6.0, min(13.0, prediction))
|
213 |
-
print(f"\033[92mDEBUG\033[0m: Bounded prediction: {prediction}")
|
214 |
-
|
215 |
-
# Format the result
|
216 |
-
result = f"🍉 Predicted Sugar Content: {prediction:.1f}° Brix 🍉\n\n"
|
217 |
-
|
218 |
-
# Add extra info about the MoE model
|
219 |
-
result += "Using Ensemble of Top-3 Models:\n"
|
220 |
-
result += "- EfficientNet-B3 + Transformer\n"
|
221 |
-
result += "- EfficientNet-B0 + Transformer\n"
|
222 |
-
result += "- ResNet-50 + Transformer\n\n"
|
223 |
-
|
224 |
-
# Add Brix scale visualization
|
225 |
-
result += "Sugar Content Scale (in °Brix):\n"
|
226 |
-
result += "──────────────────────────────────\n"
|
227 |
|
228 |
-
#
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
# Find which category the prediction falls into
|
238 |
-
user_category = None
|
239 |
-
for min_val, max_val, category_name in scale_ranges:
|
240 |
-
if min_val <= prediction < max_val:
|
241 |
-
user_category = category_name
|
242 |
-
break
|
243 |
-
if prediction >= scale_ranges[-1][0]: # Handle edge case
|
244 |
-
user_category = scale_ranges[-1][2]
|
245 |
|
246 |
-
#
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
else:
|
251 |
-
result +=
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
# Add assessment of the watermelon's sugar content
|
256 |
-
if prediction < 8:
|
257 |
-
result += "Assessment: This watermelon has low sugar content. It may taste bland or slightly bitter."
|
258 |
-
elif prediction < 9:
|
259 |
-
result += "Assessment: This watermelon has mild sweetness. Acceptable flavor but not very sweet."
|
260 |
-
elif prediction < 10:
|
261 |
-
result += "Assessment: This watermelon has moderate sugar content. It should have pleasant sweetness."
|
262 |
-
elif prediction < 11:
|
263 |
-
result += "Assessment: This watermelon has good sugar content! It should be sweet and juicy."
|
264 |
else:
|
265 |
-
|
266 |
-
|
267 |
-
return result
|
268 |
except Exception as e:
|
269 |
import traceback
|
270 |
error_msg = f"Error: {str(e)}\n\n"
|
271 |
error_msg += traceback.format_exc()
|
272 |
print(f"\033[91mERR!\033[0m: {error_msg}")
|
273 |
return error_msg
|
|
|
|
|
|
|
274 |
|
275 |
-
def create_app(
|
276 |
"""Create and launch the Gradio interface"""
|
277 |
# Define the prediction function with model path
|
278 |
def predict_fn(audio, image):
|
279 |
-
return predict_sugar_content(audio, image,
|
280 |
|
281 |
# Create Gradio interface
|
282 |
-
with gr.Blocks(title="Watermelon Sugar Content Predictor
|
283 |
-
gr.Markdown("# 🍉 Watermelon Sugar Content Predictor
|
284 |
gr.Markdown("""
|
285 |
This app predicts the sugar content (in °Brix) of a watermelon based on its sound and appearance.
|
286 |
|
287 |
-
## What's New
|
288 |
-
This version uses a Mixture of Experts (MoE) ensemble model that combines the three best-performing models:
|
289 |
-
- EfficientNet-B3 + Transformer
|
290 |
-
- EfficientNet-B0 + Transformer
|
291 |
-
- ResNet-50 + Transformer
|
292 |
-
|
293 |
-
The ensemble approach provides more accurate predictions than any single model!
|
294 |
-
|
295 |
## Instructions:
|
296 |
1. Upload or record an audio of tapping the watermelon
|
297 |
2. Upload or capture an image of the watermelon
|
@@ -305,7 +286,7 @@ def create_app(model_dir="models", weights=None):
|
|
305 |
submit_btn = gr.Button("Predict Sugar Content", variant="primary")
|
306 |
|
307 |
with gr.Column():
|
308 |
-
output = gr.Textbox(label="Prediction Results", lines=
|
309 |
|
310 |
submit_btn.click(
|
311 |
fn=predict_fn,
|
@@ -321,11 +302,6 @@ def create_app(model_dir="models", weights=None):
|
|
321 |
## About Brix Measurement
|
322 |
Brix (°Bx) is a measurement of sugar content in a solution. For watermelons, higher Brix values indicate sweeter fruit.
|
323 |
The average ripe watermelon has a Brix value between 9-11°.
|
324 |
-
|
325 |
-
## About the Mixture of Experts Model
|
326 |
-
This app uses a Mixture of Experts (MoE) model that combines predictions from multiple neural networks.
|
327 |
-
Our testing shows the ensemble approach achieves a Mean Absolute Error (MAE) of ~0.22, which is significantly
|
328 |
-
better than any individual model (best individual model: ~0.36 MAE).
|
329 |
""")
|
330 |
|
331 |
return interface
|
@@ -333,12 +309,12 @@ def create_app(model_dir="models", weights=None):
|
|
333 |
if __name__ == "__main__":
|
334 |
import argparse
|
335 |
|
336 |
-
parser = argparse.ArgumentParser(description="Watermelon Sugar Content Prediction App
|
337 |
parser.add_argument(
|
338 |
-
"--
|
339 |
type=str,
|
340 |
-
default="models",
|
341 |
-
help="
|
342 |
)
|
343 |
parser.add_argument(
|
344 |
"--share",
|
@@ -350,40 +326,18 @@ if __name__ == "__main__":
|
|
350 |
action="store_true",
|
351 |
help="Enable verbose debug output"
|
352 |
)
|
353 |
-
parser.add_argument(
|
354 |
-
"--weighting",
|
355 |
-
type=str,
|
356 |
-
choices=["uniform", "performance"],
|
357 |
-
default="uniform",
|
358 |
-
help="How to weight the models (uniform or based on performance)"
|
359 |
-
)
|
360 |
|
361 |
args = parser.parse_args()
|
362 |
|
363 |
if args.debug:
|
364 |
print(f"\033[92mINFO\033[0m: Debug mode enabled")
|
365 |
|
366 |
-
# Check if model
|
367 |
-
if not os.path.exists(args.
|
368 |
-
print(f"\033[91mERR!\033[0m: Model
|
|
|
369 |
sys.exit(1)
|
370 |
|
371 |
-
# Determine weights based on argument
|
372 |
-
weights = None
|
373 |
-
if args.weighting == "performance":
|
374 |
-
# Weights inversely proportional to the MAE (better models get higher weights)
|
375 |
-
# These are the MAE values from the evaluation results
|
376 |
-
mae_values = [0.3635, 0.3765, 0.3959] # efficientnet_b3+transformer, efficientnet_b0+transformer, resnet50+transformer
|
377 |
-
|
378 |
-
# Convert to weights (inverse of MAE, normalized)
|
379 |
-
inverse_mae = [1/mae for mae in mae_values]
|
380 |
-
total = sum(inverse_mae)
|
381 |
-
weights = [val/total for val in inverse_mae]
|
382 |
-
|
383 |
-
print(f"\033[92mINFO\033[0m: Using performance-based weights: {weights}")
|
384 |
-
else:
|
385 |
-
print(f"\033[92mINFO\033[0m: Using uniform weights")
|
386 |
-
|
387 |
# Create and launch the app
|
388 |
-
app = create_app(args.
|
389 |
app.launch(share=args.share)
|
|
|
6 |
import torchaudio
|
7 |
import torchvision
|
8 |
import spaces
|
9 |
+
|
10 |
+
# # Import Gradio Spaces GPU decorator
|
11 |
+
# try:
|
12 |
+
# from gradio import spaces
|
13 |
+
# HAS_SPACES = True
|
14 |
+
# print("\033[92mINFO\033[0m: Gradio Spaces detected, GPU acceleration will be enabled")
|
15 |
+
# except ImportError:
|
16 |
+
# HAS_SPACES = False
|
17 |
+
# print("\033[93mWARN\033[0m: gradio.spaces not available, running without GPU optimization")
|
18 |
|
19 |
# Add parent directory to path to import preprocess functions
|
20 |
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
21 |
|
22 |
+
# Import functions from infer_watermelon.py and train_watermelon for the model
|
23 |
+
from train_watermelon import WatermelonModel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
# Modified version of process_audio_data specifically for the app to handle various tensor shapes
|
26 |
def app_process_audio_data(waveform, sample_rate):
|
|
|
76 |
print(traceback.format_exc())
|
77 |
return None
|
78 |
|
79 |
+
# Similarly for images, but let's import the original one
|
80 |
+
from preprocess import process_image_data
|
81 |
+
|
82 |
+
# Using the decorator directly on the function definition
|
83 |
@spaces.GPU
|
84 |
+
def predict_sugar_content(audio, image, model_path):
|
85 |
+
"""Function with GPU acceleration to predict watermelon sugar content in Brix"""
|
86 |
try:
|
87 |
+
# Now check CUDA availability inside the GPU-decorated function
|
88 |
+
if torch.cuda.is_available():
|
89 |
+
device = torch.device("cuda")
|
90 |
+
print(f"\033[92mINFO\033[0m: CUDA is available. Using device: {device}")
|
91 |
+
else:
|
92 |
+
device = torch.device("cpu")
|
93 |
+
print(f"\033[92mINFO\033[0m: CUDA is not available. Using device: {device}")
|
94 |
+
|
95 |
+
# Load model inside the function to ensure it's on the correct device
|
96 |
+
model = WatermelonModel().to(device)
|
97 |
+
model.load_state_dict(torch.load(model_path, map_location=device))
|
98 |
+
model.eval()
|
99 |
+
print(f"\033[92mINFO\033[0m: Loaded model from {model_path}")
|
100 |
+
|
101 |
+
# Debug information about input types
|
102 |
+
print(f"\033[92mDEBUG\033[0m: Audio input type: {type(audio)}")
|
103 |
+
print(f"\033[92mDEBUG\033[0m: Audio input shape/length: {len(audio)}")
|
104 |
+
print(f"\033[92mDEBUG\033[0m: Image input type: {type(image)}")
|
105 |
+
if isinstance(image, np.ndarray):
|
106 |
+
print(f"\033[92mDEBUG\033[0m: Image input shape: {image.shape}")
|
107 |
|
108 |
# Handle different audio input formats
|
109 |
+
if isinstance(audio, tuple) and len(audio) == 2:
|
110 |
+
# Standard Gradio format: (sample_rate, audio_data)
|
111 |
+
sample_rate, audio_data = audio
|
112 |
+
print(f"\033[92mDEBUG\033[0m: Audio sample rate: {sample_rate}")
|
113 |
+
print(f"\033[92mDEBUG\033[0m: Audio data shape: {audio_data.shape}")
|
114 |
+
elif isinstance(audio, tuple) and len(audio) > 2:
|
115 |
+
# Sometimes Gradio returns (sample_rate, audio_data, other_info...)
|
116 |
+
sample_rate, audio_data = audio[0], audio[-1]
|
117 |
+
print(f"\033[92mDEBUG\033[0m: Audio sample rate: {sample_rate}")
|
118 |
+
print(f"\033[92mDEBUG\033[0m: Audio data shape: {audio_data.shape}")
|
119 |
elif isinstance(audio, str):
|
120 |
+
# Direct path to audio file
|
121 |
audio_data, sample_rate = torchaudio.load(audio)
|
122 |
+
print(f"\033[92mDEBUG\033[0m: Loaded audio from path with shape: {audio_data.shape}")
|
123 |
else:
|
124 |
return f"Error: Unsupported audio format. Got {type(audio)}"
|
125 |
|
126 |
+
# Create a temporary file path for the audio and image
|
127 |
+
temp_dir = "temp"
|
128 |
+
os.makedirs(temp_dir, exist_ok=True)
|
129 |
+
|
130 |
+
temp_audio_path = os.path.join(temp_dir, "temp_audio.wav")
|
131 |
+
temp_image_path = os.path.join(temp_dir, "temp_image.jpg")
|
132 |
+
|
133 |
+
# Import necessary libraries
|
134 |
+
from PIL import Image
|
135 |
+
|
136 |
+
# Audio handling - direct processing from the data in memory
|
137 |
if isinstance(audio_data, np.ndarray):
|
138 |
+
# Convert numpy array to tensor
|
139 |
+
print(f"\033[92mDEBUG\033[0m: Converting numpy audio with shape {audio_data.shape} to tensor")
|
140 |
audio_tensor = torch.tensor(audio_data).float()
|
141 |
+
|
142 |
+
# Handle different audio dimensions
|
143 |
+
if audio_data.ndim == 1:
|
144 |
+
# Single channel audio
|
145 |
+
audio_tensor = audio_tensor.unsqueeze(0)
|
146 |
+
elif audio_data.ndim == 2:
|
147 |
+
# Ensure channels are first dimension
|
148 |
+
if audio_data.shape[0] > audio_data.shape[1]:
|
149 |
+
# More rows than columns, probably (samples, channels)
|
150 |
+
audio_tensor = torch.tensor(audio_data.T).float()
|
151 |
else:
|
152 |
+
# Already a tensor
|
153 |
audio_tensor = audio_data.float()
|
154 |
|
155 |
+
print(f"\033[92mDEBUG\033[0m: Audio tensor shape before processing: {audio_tensor.shape}")
|
156 |
+
|
157 |
+
# Skip saving/loading and process directly
|
158 |
mfcc = app_process_audio_data(audio_tensor, sample_rate)
|
159 |
+
print(f"\033[92mDEBUG\033[0m: MFCC tensor shape after processing: {mfcc.shape if mfcc is not None else None}")
|
|
|
160 |
|
161 |
+
# Image handling
|
162 |
if isinstance(image, np.ndarray):
|
163 |
+
print(f"\033[92mDEBUG\033[0m: Converting numpy image with shape {image.shape} to PIL")
|
164 |
+
pil_image = Image.fromarray(image)
|
165 |
+
pil_image.save(temp_image_path)
|
166 |
+
print(f"\033[92mDEBUG\033[0m: Saved image to {temp_image_path}")
|
167 |
elif isinstance(image, str):
|
168 |
+
# If image is already a path
|
169 |
+
temp_image_path = image
|
170 |
+
print(f"\033[92mDEBUG\033[0m: Using provided image path: {temp_image_path}")
|
171 |
else:
|
172 |
return f"Error: Unsupported image format. Got {type(image)}"
|
173 |
|
174 |
+
# Process image
|
175 |
+
print(f"\033[92mDEBUG\033[0m: Loading and preprocessing image from {temp_image_path}")
|
176 |
+
image_tensor = torchvision.io.read_image(temp_image_path)
|
177 |
+
print(f"\033[92mDEBUG\033[0m: Loaded image shape: {image_tensor.shape}")
|
178 |
image_tensor = image_tensor.float()
|
179 |
processed_image = process_image_data(image_tensor)
|
180 |
+
print(f"\033[92mDEBUG\033[0m: Processed image shape: {processed_image.shape if processed_image is not None else None}")
|
|
|
181 |
|
182 |
+
# Add batch dimension for inference and move to device
|
183 |
+
if mfcc is not None:
|
184 |
+
mfcc = mfcc.unsqueeze(0).to(device)
|
185 |
+
print(f"\033[92mDEBUG\033[0m: Final MFCC shape with batch dimension: {mfcc.shape}")
|
186 |
|
187 |
+
if processed_image is not None:
|
188 |
+
processed_image = processed_image.unsqueeze(0).to(device)
|
189 |
+
print(f"\033[92mDEBUG\033[0m: Final image shape with batch dimension: {processed_image.shape}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
+
# Run inference
|
192 |
+
print(f"\033[92mDEBUG\033[0m: Running inference on device: {device}")
|
193 |
+
if mfcc is not None and processed_image is not None:
|
194 |
+
with torch.no_grad():
|
195 |
+
brix_value = model(mfcc, processed_image)
|
196 |
+
print(f"\033[92mDEBUG\033[0m: Prediction successful: {brix_value.item()}")
|
197 |
+
else:
|
198 |
+
return "Error: Failed to process inputs. Please check the debug logs."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
|
200 |
+
# Format the result with a range display
|
201 |
+
if brix_value is not None:
|
202 |
+
brix_score = brix_value.item()
|
203 |
+
|
204 |
+
# Create a header with the numerical result
|
205 |
+
result = f"🍉 Predicted Sugar Content: {brix_score:.1f}° Brix 🍉\n\n"
|
206 |
+
|
207 |
+
# Add Brix scale visualization
|
208 |
+
result += "Sugar Content Scale (in °Brix):\n"
|
209 |
+
result += "──────────────────────────────────\n"
|
210 |
+
|
211 |
+
# Create the scale display with Brix ranges
|
212 |
+
scale_ranges = [
|
213 |
+
(0, 8, "Low Sugar (< 8° Brix)"),
|
214 |
+
(8, 9, "Mild Sweetness (8-9° Brix)"),
|
215 |
+
(9, 10, "Medium Sweetness (9-10° Brix)"),
|
216 |
+
(10, 11, "Sweet (10-11° Brix)"),
|
217 |
+
(11, 13, "Very Sweet (11-13° Brix)")
|
218 |
+
]
|
219 |
+
|
220 |
+
# Find which category the prediction falls into
|
221 |
+
user_category = None
|
222 |
+
for min_val, max_val, category_name in scale_ranges:
|
223 |
+
if min_val <= brix_score < max_val:
|
224 |
+
user_category = category_name
|
225 |
+
break
|
226 |
+
if brix_score >= scale_ranges[-1][0]: # Handle edge case
|
227 |
+
user_category = scale_ranges[-1][2]
|
228 |
+
|
229 |
+
# Display the scale with the user's result highlighted
|
230 |
+
for min_val, max_val, category_name in scale_ranges:
|
231 |
+
if category_name == user_category:
|
232 |
+
result += f"▶ {min_val}-{max_val}: {category_name} ◀ (YOUR WATERMELON)\n"
|
233 |
+
else:
|
234 |
+
result += f" {min_val}-{max_val}: {category_name}\n"
|
235 |
+
|
236 |
+
result += "──────────────────────────────────\n\n"
|
237 |
+
|
238 |
+
# Add assessment of the watermelon's sugar content
|
239 |
+
if brix_score < 8:
|
240 |
+
result += "Assessment: This watermelon has low sugar content. It may taste bland or slightly bitter."
|
241 |
+
elif brix_score < 9:
|
242 |
+
result += "Assessment: This watermelon has mild sweetness. Acceptable flavor but not very sweet."
|
243 |
+
elif brix_score < 10:
|
244 |
+
result += "Assessment: This watermelon has moderate sugar content. It should have pleasant sweetness."
|
245 |
+
elif brix_score < 11:
|
246 |
+
result += "Assessment: This watermelon has good sugar content! It should be sweet and juicy."
|
247 |
else:
|
248 |
+
result += "Assessment: This watermelon has excellent sugar content! Perfect choice for maximum sweetness and flavor."
|
249 |
+
|
250 |
+
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
else:
|
252 |
+
return "Error: Could not predict sugar content. Please try again with different inputs."
|
253 |
+
|
|
|
254 |
except Exception as e:
|
255 |
import traceback
|
256 |
error_msg = f"Error: {str(e)}\n\n"
|
257 |
error_msg += traceback.format_exc()
|
258 |
print(f"\033[91mERR!\033[0m: {error_msg}")
|
259 |
return error_msg
|
260 |
+
|
261 |
+
print("\033[92mINFO\033[0m: GPU-accelerated prediction function created with @spaces.GPU decorator")
|
262 |
+
|
263 |
|
264 |
+
def create_app(model_path):
|
265 |
"""Create and launch the Gradio interface"""
|
266 |
# Define the prediction function with model path
|
267 |
def predict_fn(audio, image):
|
268 |
+
return predict_sugar_content(audio, image, model_path)
|
269 |
|
270 |
# Create Gradio interface
|
271 |
+
with gr.Blocks(title="Watermelon Sugar Content Predictor", theme=gr.themes.Soft()) as interface:
|
272 |
+
gr.Markdown("# 🍉 Watermelon Sugar Content Predictor")
|
273 |
gr.Markdown("""
|
274 |
This app predicts the sugar content (in °Brix) of a watermelon based on its sound and appearance.
|
275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
## Instructions:
|
277 |
1. Upload or record an audio of tapping the watermelon
|
278 |
2. Upload or capture an image of the watermelon
|
|
|
286 |
submit_btn = gr.Button("Predict Sugar Content", variant="primary")
|
287 |
|
288 |
with gr.Column():
|
289 |
+
output = gr.Textbox(label="Prediction Results", lines=12)
|
290 |
|
291 |
submit_btn.click(
|
292 |
fn=predict_fn,
|
|
|
302 |
## About Brix Measurement
|
303 |
Brix (°Bx) is a measurement of sugar content in a solution. For watermelons, higher Brix values indicate sweeter fruit.
|
304 |
The average ripe watermelon has a Brix value between 9-11°.
|
|
|
|
|
|
|
|
|
|
|
305 |
""")
|
306 |
|
307 |
return interface
|
|
|
309 |
if __name__ == "__main__":
|
310 |
import argparse
|
311 |
|
312 |
+
parser = argparse.ArgumentParser(description="Watermelon Sugar Content Prediction App")
|
313 |
parser.add_argument(
|
314 |
+
"--model_path",
|
315 |
type=str,
|
316 |
+
default="models/watermelon_model_final.pt",
|
317 |
+
help="Path to the trained model file"
|
318 |
)
|
319 |
parser.add_argument(
|
320 |
"--share",
|
|
|
326 |
action="store_true",
|
327 |
help="Enable verbose debug output"
|
328 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
|
330 |
args = parser.parse_args()
|
331 |
|
332 |
if args.debug:
|
333 |
print(f"\033[92mINFO\033[0m: Debug mode enabled")
|
334 |
|
335 |
+
# Check if model exists
|
336 |
+
if not os.path.exists(args.model_path):
|
337 |
+
print(f"\033[91mERR!\033[0m: Model not found at {args.model_path}")
|
338 |
+
print("\033[92mINFO\033[0m: Please train a model first or provide a valid model path")
|
339 |
sys.exit(1)
|
340 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
# Create and launch the app
|
342 |
+
app = create_app(args.model_path)
|
343 |
app.launch(share=args.share)
|
app_moe.py
CHANGED
@@ -5,7 +5,6 @@ import numpy as np
|
|
5 |
import gradio as gr
|
6 |
import torchaudio
|
7 |
import torchvision
|
8 |
-
import spaces
|
9 |
import json
|
10 |
|
11 |
# Add parent directory to path to import preprocess functions
|
@@ -34,11 +33,10 @@ class WatermelonMoEModel(torch.nn.Module):
|
|
34 |
weights: Optional list of weights for each model (None for equal weighting)
|
35 |
"""
|
36 |
super(WatermelonMoEModel, self).__init__()
|
37 |
-
self.models =
|
38 |
self.model_configs = model_configs
|
39 |
|
40 |
# Load each model
|
41 |
-
loaded_count = 0
|
42 |
for config in model_configs:
|
43 |
img_backbone = config["image_backbone"]
|
44 |
audio_backbone = config["audio_backbone"]
|
@@ -50,31 +48,22 @@ class WatermelonMoEModel(torch.nn.Module):
|
|
50 |
model_path = os.path.join(model_dir, f"{img_backbone}_{audio_backbone}_model.pt")
|
51 |
if os.path.exists(model_path):
|
52 |
print(f"\033[92mINFO\033[0m: Loading model {img_backbone}_{audio_backbone} from {model_path}")
|
53 |
-
|
54 |
-
model.load_state_dict(torch.load(model_path, map_location='cpu'))
|
55 |
-
model.eval() # Set to evaluation mode
|
56 |
-
self.models.append(model)
|
57 |
-
loaded_count += 1
|
58 |
-
except Exception as e:
|
59 |
-
print(f"\033[91mERR!\033[0m: Failed to load model from {model_path}: {e}")
|
60 |
-
continue
|
61 |
else:
|
62 |
print(f"\033[91mERR!\033[0m: Model checkpoint not found at {model_path}")
|
63 |
continue
|
|
|
|
|
|
|
64 |
|
65 |
-
# Add a dummy parameter if no models were loaded to prevent StopIteration
|
66 |
-
if loaded_count == 0:
|
67 |
-
print(f"\033[91mERR!\033[0m: No models were successfully loaded!")
|
68 |
-
self.dummy_param = torch.nn.Parameter(torch.zeros(1))
|
69 |
-
|
70 |
# Set model weights (uniform by default)
|
71 |
-
if weights
|
72 |
assert len(weights) == len(self.models), "Number of weights must match number of models"
|
73 |
self.weights = weights
|
74 |
else:
|
75 |
-
self.weights = [1.0 /
|
76 |
|
77 |
-
print(f"\033[92mINFO\033[0m: Loaded {
|
78 |
print(f"\033[92mINFO\033[0m: Model weights: {self.weights}")
|
79 |
|
80 |
def to(self, device):
|
@@ -90,10 +79,9 @@ class WatermelonMoEModel(torch.nn.Module):
|
|
90 |
Forward pass through the MoE model.
|
91 |
Returns the weighted average of all model outputs.
|
92 |
"""
|
93 |
-
# Check if we have models loaded
|
94 |
if not self.models:
|
95 |
print(f"\033[91mERR!\033[0m: No models available for inference!")
|
96 |
-
return torch.tensor([0.0], device=mfcc.device)
|
97 |
|
98 |
outputs = []
|
99 |
|
@@ -101,6 +89,8 @@ class WatermelonMoEModel(torch.nn.Module):
|
|
101 |
with torch.no_grad():
|
102 |
for i, model in enumerate(self.models):
|
103 |
output = model(mfcc, image)
|
|
|
|
|
104 |
outputs.append(output * self.weights[i])
|
105 |
|
106 |
# Return weighted average
|
@@ -161,201 +151,118 @@ def app_process_audio_data(waveform, sample_rate):
|
|
161 |
return None
|
162 |
|
163 |
# Using the decorator for GPU acceleration
|
164 |
-
@spaces.GPU
|
165 |
def predict_sugar_content(audio, image, model_dir="models", weights=None):
|
166 |
"""Function with GPU acceleration to predict watermelon sugar content in Brix using MoE model"""
|
167 |
try:
|
168 |
# Check CUDA availability inside the GPU-decorated function
|
169 |
-
if torch.cuda.is_available()
|
170 |
-
|
171 |
-
print(f"\033[92mINFO\033[0m: CUDA is available. Using device: {device}")
|
172 |
-
else:
|
173 |
-
device = torch.device("cpu")
|
174 |
-
print(f"\033[92mINFO\033[0m: CUDA is not available. Using device: {device}")
|
175 |
|
176 |
# Load MoE model
|
177 |
moe_model = WatermelonMoEModel(TOP_MODELS, model_dir, weights)
|
178 |
-
|
179 |
-
moe_model = moe_model.to(device)
|
180 |
moe_model.eval()
|
181 |
print(f"\033[92mINFO\033[0m: Loaded MoE model with {len(moe_model.models)} backbone models")
|
182 |
|
183 |
-
# Debug information about input types
|
184 |
-
print(f"\033[92mDEBUG\033[0m: Audio input type: {type(audio)}")
|
185 |
-
print(f"\033[92mDEBUG\033[0m: Audio input shape/length: {len(audio)}")
|
186 |
-
print(f"\033[92mDEBUG\033[0m: Image input type: {type(image)}")
|
187 |
-
if isinstance(image, np.ndarray):
|
188 |
-
print(f"\033[92mDEBUG\033[0m: Image input shape: {image.shape}")
|
189 |
-
|
190 |
# Handle different audio input formats
|
191 |
-
if isinstance(audio, tuple) and len(audio)
|
192 |
-
|
193 |
-
sample_rate, audio_data = audio
|
194 |
-
print(f"\033[92mDEBUG\033[0m: Audio sample rate: {sample_rate}")
|
195 |
-
print(f"\033[92mDEBUG\033[0m: Audio data shape: {audio_data.shape}")
|
196 |
-
elif isinstance(audio, tuple) and len(audio) > 2:
|
197 |
-
# Sometimes Gradio returns (sample_rate, audio_data, other_info...)
|
198 |
-
sample_rate, audio_data = audio[0], audio[-1]
|
199 |
-
print(f"\033[92mDEBUG\033[0m: Audio sample rate: {sample_rate}")
|
200 |
-
print(f"\033[92mDEBUG\033[0m: Audio data shape: {audio_data.shape}")
|
201 |
elif isinstance(audio, str):
|
202 |
-
# Direct path to audio file
|
203 |
audio_data, sample_rate = torchaudio.load(audio)
|
204 |
-
print(f"\033[92mDEBUG\033[0m: Loaded audio from path with shape: {audio_data.shape}")
|
205 |
else:
|
206 |
return f"Error: Unsupported audio format. Got {type(audio)}"
|
207 |
|
208 |
-
#
|
209 |
-
temp_dir = "temp"
|
210 |
-
os.makedirs(temp_dir, exist_ok=True)
|
211 |
-
|
212 |
-
temp_audio_path = os.path.join(temp_dir, "temp_audio.wav")
|
213 |
-
temp_image_path = os.path.join(temp_dir, "temp_image.jpg")
|
214 |
-
|
215 |
-
# Import necessary libraries
|
216 |
-
from PIL import Image
|
217 |
-
|
218 |
-
# Audio handling - direct processing from the data in memory
|
219 |
if isinstance(audio_data, np.ndarray):
|
220 |
-
# Convert numpy array to tensor
|
221 |
-
print(f"\033[92mDEBUG\033[0m: Converting numpy audio with shape {audio_data.shape} to tensor")
|
222 |
audio_tensor = torch.tensor(audio_data).float()
|
223 |
-
|
224 |
-
# Handle different audio dimensions
|
225 |
-
if audio_data.ndim == 1:
|
226 |
-
# Single channel audio
|
227 |
-
audio_tensor = audio_tensor.unsqueeze(0)
|
228 |
-
elif audio_data.ndim == 2:
|
229 |
-
# Ensure channels are first dimension
|
230 |
-
if audio_data.shape[0] > audio_data.shape[1]:
|
231 |
-
# More rows than columns, probably (samples, channels)
|
232 |
-
audio_tensor = torch.tensor(audio_data.T).float()
|
233 |
else:
|
234 |
-
# Already a tensor
|
235 |
audio_tensor = audio_data.float()
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
# Skip saving/loading and process directly
|
240 |
mfcc = app_process_audio_data(audio_tensor, sample_rate)
|
241 |
-
|
|
|
242 |
|
243 |
-
#
|
244 |
if isinstance(image, np.ndarray):
|
245 |
-
|
246 |
-
pil_image = Image.fromarray(image)
|
247 |
-
pil_image.save(temp_image_path)
|
248 |
-
print(f"\033[92mDEBUG\033[0m: Saved image to {temp_image_path}")
|
249 |
elif isinstance(image, str):
|
250 |
-
|
251 |
-
temp_image_path = image
|
252 |
-
print(f"\033[92mDEBUG\033[0m: Using provided image path: {temp_image_path}")
|
253 |
else:
|
254 |
return f"Error: Unsupported image format. Got {type(image)}"
|
255 |
|
256 |
-
# Process image
|
257 |
-
print(f"\033[92mDEBUG\033[0m: Loading and preprocessing image from {temp_image_path}")
|
258 |
-
image_tensor = torchvision.io.read_image(temp_image_path)
|
259 |
-
print(f"\033[92mDEBUG\033[0m: Loaded image shape: {image_tensor.shape}")
|
260 |
image_tensor = image_tensor.float()
|
261 |
processed_image = process_image_data(image_tensor)
|
262 |
-
|
263 |
-
|
264 |
-
# Add batch dimension for inference and move to device
|
265 |
-
if mfcc is not None:
|
266 |
-
# Ensure mfcc is on the same device as the model
|
267 |
-
mfcc = mfcc.unsqueeze(0).to(device)
|
268 |
-
print(f"\033[92mDEBUG\033[0m: Final MFCC shape with batch dimension: {mfcc.shape}, device: {mfcc.device}")
|
269 |
-
|
270 |
-
if processed_image is not None:
|
271 |
-
# Ensure processed_image is on the same device as the model
|
272 |
-
processed_image = processed_image.unsqueeze(0).to(device)
|
273 |
-
print(f"\033[92mDEBUG\033[0m: Final image shape with batch dimension: {processed_image.shape}, device: {processed_image.device}")
|
274 |
-
|
275 |
-
# Double-check model is on the correct device
|
276 |
-
try:
|
277 |
-
param = next(moe_model.parameters())
|
278 |
-
print(f"\033[92mDEBUG\033[0m: MoE model device: {param.device}")
|
279 |
-
|
280 |
-
# Check individual models
|
281 |
-
for i, model in enumerate(moe_model.models):
|
282 |
-
try:
|
283 |
-
model_param = next(model.parameters())
|
284 |
-
print(f"\033[92mDEBUG\033[0m: Model {i} device: {model_param.device}")
|
285 |
-
except StopIteration:
|
286 |
-
print(f"\033[91mERR!\033[0m: Model {i} has no parameters!")
|
287 |
-
except StopIteration:
|
288 |
-
print(f"\033[91mERR!\033[0m: MoE model has no parameters!")
|
289 |
-
|
290 |
-
# Run inference with MoE model
|
291 |
-
print(f"\033[92mDEBUG\033[0m: Running inference with MoE model on device: {device}")
|
292 |
-
if mfcc is not None and processed_image is not None:
|
293 |
-
with torch.no_grad():
|
294 |
-
brix_value = moe_model(mfcc, processed_image)
|
295 |
-
print(f"\033[92mDEBUG\033[0m: Prediction successful: {brix_value.item()}")
|
296 |
-
else:
|
297 |
-
return "Error: Failed to process inputs. Please check the debug logs."
|
298 |
|
299 |
-
#
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
result += "- EfficientNet-B3 + Transformer\n"
|
309 |
-
result += "- EfficientNet-B0 + Transformer\n"
|
310 |
-
result += "- ResNet-50 + Transformer\n\n"
|
311 |
-
|
312 |
-
# Add Brix scale visualization
|
313 |
-
result += "Sugar Content Scale (in °Brix):\n"
|
314 |
-
result += "──────────────────────────────────\n"
|
315 |
-
|
316 |
-
# Create the scale display with Brix ranges
|
317 |
-
scale_ranges = [
|
318 |
-
(0, 8, "Low Sugar (< 8° Brix)"),
|
319 |
-
(8, 9, "Mild Sweetness (8-9° Brix)"),
|
320 |
-
(9, 10, "Medium Sweetness (9-10° Brix)"),
|
321 |
-
(10, 11, "Sweet (10-11° Brix)"),
|
322 |
-
(11, 13, "Very Sweet (11-13° Brix)")
|
323 |
-
]
|
324 |
-
|
325 |
-
# Find which category the prediction falls into
|
326 |
-
user_category = None
|
327 |
-
for min_val, max_val, category_name in scale_ranges:
|
328 |
-
if min_val <= brix_score < max_val:
|
329 |
-
user_category = category_name
|
330 |
-
break
|
331 |
-
if brix_score >= scale_ranges[-1][0]: # Handle edge case
|
332 |
-
user_category = scale_ranges[-1][2]
|
333 |
-
|
334 |
-
# Display the scale with the user's result highlighted
|
335 |
-
for min_val, max_val, category_name in scale_ranges:
|
336 |
-
if category_name == user_category:
|
337 |
-
result += f"▶ {min_val}-{max_val}: {category_name} ◀ (YOUR WATERMELON)\n"
|
338 |
-
else:
|
339 |
-
result += f" {min_val}-{max_val}: {category_name}\n"
|
340 |
-
|
341 |
-
result += "──────────────────────────────────\n\n"
|
342 |
|
343 |
-
#
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
else:
|
353 |
-
result += "
|
354 |
-
|
355 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
else:
|
357 |
-
|
358 |
-
|
|
|
359 |
except Exception as e:
|
360 |
import traceback
|
361 |
error_msg = f"Error: {str(e)}\n\n"
|
|
|
5 |
import gradio as gr
|
6 |
import torchaudio
|
7 |
import torchvision
|
|
|
8 |
import json
|
9 |
|
10 |
# Add parent directory to path to import preprocess functions
|
|
|
33 |
weights: Optional list of weights for each model (None for equal weighting)
|
34 |
"""
|
35 |
super(WatermelonMoEModel, self).__init__()
|
36 |
+
self.models = []
|
37 |
self.model_configs = model_configs
|
38 |
|
39 |
# Load each model
|
|
|
40 |
for config in model_configs:
|
41 |
img_backbone = config["image_backbone"]
|
42 |
audio_backbone = config["audio_backbone"]
|
|
|
48 |
model_path = os.path.join(model_dir, f"{img_backbone}_{audio_backbone}_model.pt")
|
49 |
if os.path.exists(model_path):
|
50 |
print(f"\033[92mINFO\033[0m: Loading model {img_backbone}_{audio_backbone} from {model_path}")
|
51 |
+
model.load_state_dict(torch.load(model_path, map_location='cpu'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
else:
|
53 |
print(f"\033[91mERR!\033[0m: Model checkpoint not found at {model_path}")
|
54 |
continue
|
55 |
+
|
56 |
+
model.eval() # Set to evaluation mode
|
57 |
+
self.models.append(model)
|
58 |
|
|
|
|
|
|
|
|
|
|
|
59 |
# Set model weights (uniform by default)
|
60 |
+
if weights:
|
61 |
assert len(weights) == len(self.models), "Number of weights must match number of models"
|
62 |
self.weights = weights
|
63 |
else:
|
64 |
+
self.weights = [1.0 / len(self.models)] * len(self.models) if self.models else [1.0]
|
65 |
|
66 |
+
print(f"\033[92mINFO\033[0m: Loaded {len(self.models)} models for MoE ensemble")
|
67 |
print(f"\033[92mINFO\033[0m: Model weights: {self.weights}")
|
68 |
|
69 |
def to(self, device):
|
|
|
79 |
Forward pass through the MoE model.
|
80 |
Returns the weighted average of all model outputs.
|
81 |
"""
|
|
|
82 |
if not self.models:
|
83 |
print(f"\033[91mERR!\033[0m: No models available for inference!")
|
84 |
+
return torch.tensor([0.0], device=mfcc.device)
|
85 |
|
86 |
outputs = []
|
87 |
|
|
|
89 |
with torch.no_grad():
|
90 |
for i, model in enumerate(self.models):
|
91 |
output = model(mfcc, image)
|
92 |
+
# print the output value
|
93 |
+
print(f"\033[92mDEBUG\033[0m: Model {i} output: {output}")
|
94 |
outputs.append(output * self.weights[i])
|
95 |
|
96 |
# Return weighted average
|
|
|
151 |
return None
|
152 |
|
153 |
# Using the decorator for GPU acceleration
|
|
|
154 |
def predict_sugar_content(audio, image, model_dir="models", weights=None):
|
155 |
"""Function with GPU acceleration to predict watermelon sugar content in Brix using MoE model"""
|
156 |
try:
|
157 |
# Check CUDA availability inside the GPU-decorated function
|
158 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
159 |
+
print(f"\033[92mINFO\033[0m: Using device: {device}")
|
|
|
|
|
|
|
|
|
160 |
|
161 |
# Load MoE model
|
162 |
moe_model = WatermelonMoEModel(TOP_MODELS, model_dir, weights)
|
163 |
+
moe_model = moe_model.to(device) # Move entire model to device
|
|
|
164 |
moe_model.eval()
|
165 |
print(f"\033[92mINFO\033[0m: Loaded MoE model with {len(moe_model.models)} backbone models")
|
166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
# Handle different audio input formats
|
168 |
+
if isinstance(audio, tuple) and len(audio) >= 2:
|
169 |
+
sample_rate, audio_data = audio[0], audio[1] if len(audio) == 2 else audio[-1]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
elif isinstance(audio, str):
|
|
|
171 |
audio_data, sample_rate = torchaudio.load(audio)
|
|
|
172 |
else:
|
173 |
return f"Error: Unsupported audio format. Got {type(audio)}"
|
174 |
|
175 |
+
# Convert audio to tensor if needed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
if isinstance(audio_data, np.ndarray):
|
|
|
|
|
177 |
audio_tensor = torch.tensor(audio_data).float()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
else:
|
|
|
179 |
audio_tensor = audio_data.float()
|
180 |
|
181 |
+
# Process audio
|
|
|
|
|
182 |
mfcc = app_process_audio_data(audio_tensor, sample_rate)
|
183 |
+
if mfcc is None:
|
184 |
+
return "Error: Failed to process audio input"
|
185 |
|
186 |
+
# Process image
|
187 |
if isinstance(image, np.ndarray):
|
188 |
+
image_tensor = torch.from_numpy(image).permute(2, 0, 1) # Convert to CxHxW format
|
|
|
|
|
|
|
189 |
elif isinstance(image, str):
|
190 |
+
image_tensor = torchvision.io.read_image(image)
|
|
|
|
|
191 |
else:
|
192 |
return f"Error: Unsupported image format. Got {type(image)}"
|
193 |
|
|
|
|
|
|
|
|
|
194 |
image_tensor = image_tensor.float()
|
195 |
processed_image = process_image_data(image_tensor)
|
196 |
+
if processed_image is None:
|
197 |
+
return "Error: Failed to process image input"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
+
# Add batch dimension and move to device
|
200 |
+
mfcc = mfcc.unsqueeze(0).to(device)
|
201 |
+
processed_image = processed_image.unsqueeze(0).to(device)
|
202 |
+
|
203 |
+
# Run inference
|
204 |
+
with torch.no_grad():
|
205 |
+
brix_value = moe_model(mfcc, processed_image)
|
206 |
+
prediction = brix_value.item()
|
207 |
+
print(f"\033[92mDEBUG\033[0m: Raw prediction: {prediction}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
|
209 |
+
# Ensure prediction is within reasonable bounds (e.g., 6-13 Brix)
|
210 |
+
prediction = max(6.0, min(13.0, prediction))
|
211 |
+
print(f"\033[92mDEBUG\033[0m: Bounded prediction: {prediction}")
|
212 |
+
|
213 |
+
# Format the result
|
214 |
+
result = f"🍉 Predicted Sugar Content: {prediction:.1f}° Brix 🍉\n\n"
|
215 |
+
|
216 |
+
# Add extra info about the MoE model
|
217 |
+
result += "Using Ensemble of Top-3 Models:\n"
|
218 |
+
result += "- EfficientNet-B3 + Transformer\n"
|
219 |
+
result += "- EfficientNet-B0 + Transformer\n"
|
220 |
+
result += "- ResNet-50 + Transformer\n\n"
|
221 |
+
|
222 |
+
# Add Brix scale visualization
|
223 |
+
result += "Sugar Content Scale (in °Brix):\n"
|
224 |
+
result += "──────────────────────────────────\n"
|
225 |
+
|
226 |
+
# Create the scale display with Brix ranges
|
227 |
+
scale_ranges = [
|
228 |
+
(0, 8, "Low Sugar (< 8° Brix)"),
|
229 |
+
(8, 9, "Mild Sweetness (8-9° Brix)"),
|
230 |
+
(9, 10, "Medium Sweetness (9-10° Brix)"),
|
231 |
+
(10, 11, "Sweet (10-11° Brix)"),
|
232 |
+
(11, 13, "Very Sweet (11-13° Brix)")
|
233 |
+
]
|
234 |
+
|
235 |
+
# Find which category the prediction falls into
|
236 |
+
user_category = None
|
237 |
+
for min_val, max_val, category_name in scale_ranges:
|
238 |
+
if min_val <= prediction < max_val:
|
239 |
+
user_category = category_name
|
240 |
+
break
|
241 |
+
if prediction >= scale_ranges[-1][0]: # Handle edge case
|
242 |
+
user_category = scale_ranges[-1][2]
|
243 |
+
|
244 |
+
# Display the scale with the user's result highlighted
|
245 |
+
for min_val, max_val, category_name in scale_ranges:
|
246 |
+
if category_name == user_category:
|
247 |
+
result += f"▶ {min_val}-{max_val}: {category_name} ◀ (YOUR WATERMELON)\n"
|
248 |
else:
|
249 |
+
result += f" {min_val}-{max_val}: {category_name}\n"
|
250 |
+
|
251 |
+
result += "──────────────────────────────────\n\n"
|
252 |
+
|
253 |
+
# Add assessment of the watermelon's sugar content
|
254 |
+
if prediction < 8:
|
255 |
+
result += "Assessment: This watermelon has low sugar content. It may taste bland or slightly bitter."
|
256 |
+
elif prediction < 9:
|
257 |
+
result += "Assessment: This watermelon has mild sweetness. Acceptable flavor but not very sweet."
|
258 |
+
elif prediction < 10:
|
259 |
+
result += "Assessment: This watermelon has moderate sugar content. It should have pleasant sweetness."
|
260 |
+
elif prediction < 11:
|
261 |
+
result += "Assessment: This watermelon has good sugar content! It should be sweet and juicy."
|
262 |
else:
|
263 |
+
result += "Assessment: This watermelon has excellent sugar content! Perfect choice for maximum sweetness and flavor."
|
264 |
+
|
265 |
+
return result
|
266 |
except Exception as e:
|
267 |
import traceback
|
268 |
error_msg = f"Error: {str(e)}\n\n"
|
moe_evaluation_results.json
CHANGED
@@ -1,801 +1,801 @@
|
|
1 |
{
|
2 |
-
"moe_test_mae": 0.
|
3 |
-
"moe_test_mse": 0.
|
4 |
"true_labels": [
|
5 |
11.100000381469727,
|
6 |
-
|
7 |
-
|
8 |
-
10.300000190734863,
|
9 |
-
10.300000190734863,
|
10 |
8.699999809265137,
|
|
|
|
|
|
|
11 |
9.600000381469727,
|
12 |
-
|
13 |
-
10.300000190734863,
|
14 |
12.699999809265137,
|
|
|
15 |
10.899999618530273,
|
16 |
-
12.699999809265137,
|
17 |
11.0,
|
18 |
-
12.699999809265137,
|
19 |
8.699999809265137,
|
|
|
20 |
11.600000381469727,
|
|
|
|
|
|
|
21 |
11.0,
|
|
|
|
|
|
|
22 |
11.0,
|
23 |
-
|
|
|
24 |
11.0,
|
25 |
-
9.600000381469727,
|
26 |
11.100000381469727,
|
27 |
-
|
28 |
-
|
29 |
-
9.
|
|
|
|
|
|
|
30 |
10.199999809265137,
|
31 |
-
|
32 |
-
|
33 |
-
9.699999809265137,
|
34 |
-
10.399999618530273,
|
35 |
12.699999809265137,
|
|
|
|
|
|
|
|
|
36 |
9.399999618530273,
|
|
|
|
|
|
|
37 |
9.399999618530273,
|
38 |
-
|
|
|
|
|
|
|
39 |
9.399999618530273,
|
40 |
-
|
41 |
9.399999618530273,
|
42 |
-
|
43 |
-
11.0,
|
44 |
-
12.699999809265137,
|
45 |
9.399999618530273,
|
46 |
-
|
47 |
-
8.699999809265137,
|
48 |
10.800000190734863,
|
49 |
-
10.300000190734863,
|
50 |
-
10.899999618530273,
|
51 |
11.0,
|
|
|
|
|
|
|
|
|
|
|
52 |
10.899999618530273,
|
53 |
-
10.
|
|
|
|
|
54 |
11.0,
|
|
|
55 |
11.100000381469727,
|
|
|
56 |
9.399999618530273,
|
57 |
-
10.5,
|
58 |
-
11.600000381469727,
|
59 |
10.300000190734863,
|
60 |
-
|
|
|
|
|
|
|
61 |
9.399999618530273,
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
9.399999618530273,
|
|
|
63 |
11.600000381469727,
|
64 |
-
|
65 |
9.399999618530273,
|
|
|
66 |
10.399999618530273,
|
|
|
67 |
10.300000190734863,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
8.699999809265137,
|
69 |
-
|
|
|
70 |
10.300000190734863,
|
71 |
9.399999618530273,
|
72 |
10.300000190734863,
|
|
|
73 |
10.199999809265137,
|
74 |
-
9.399999618530273,
|
75 |
-
9.600000381469727,
|
76 |
11.600000381469727,
|
77 |
10.5,
|
78 |
-
|
|
|
79 |
11.0,
|
|
|
|
|
|
|
|
|
80 |
11.600000381469727,
|
81 |
11.0,
|
82 |
-
8.699999809265137,
|
83 |
-
9.399999618530273,
|
84 |
-
12.699999809265137,
|
85 |
11.100000381469727,
|
86 |
-
9.399999618530273,
|
87 |
-
9.399999618530273,
|
88 |
-
10.899999618530273,
|
89 |
10.300000190734863,
|
|
|
|
|
|
|
90 |
9.699999809265137,
|
91 |
-
11.600000381469727,
|
92 |
11.0,
|
93 |
9.699999809265137,
|
94 |
-
|
95 |
-
|
96 |
10.300000190734863,
|
97 |
-
10.399999618530273,
|
98 |
-
10.399999618530273,
|
99 |
-
10.199999809265137,
|
100 |
11.0,
|
101 |
-
|
|
|
102 |
12.699999809265137,
|
103 |
-
11.0,
|
104 |
-
10.800000190734863,
|
105 |
-
10.5,
|
106 |
10.300000190734863,
|
107 |
10.300000190734863,
|
108 |
-
9.399999618530273,
|
109 |
-
11.0,
|
110 |
-
9.699999809265137,
|
111 |
-
10.300000190734863,
|
112 |
-
12.699999809265137,
|
113 |
-
11.0,
|
114 |
-
9.399999618530273,
|
115 |
-
11.100000381469727,
|
116 |
-
9.600000381469727,
|
117 |
-
10.5,
|
118 |
-
10.0,
|
119 |
-
10.5,
|
120 |
-
9.600000381469727,
|
121 |
-
11.600000381469727,
|
122 |
-
11.0,
|
123 |
-
8.699999809265137,
|
124 |
-
11.0,
|
125 |
-
11.0,
|
126 |
-
9.699999809265137,
|
127 |
-
10.800000190734863,
|
128 |
-
9.399999618530273,
|
129 |
-
9.399999618530273,
|
130 |
10.899999618530273,
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
9.399999618530273,
|
135 |
9.0,
|
136 |
-
|
137 |
-
8.699999809265137,
|
138 |
10.300000190734863,
|
139 |
11.600000381469727,
|
140 |
-
10.0,
|
141 |
-
10.899999618530273,
|
142 |
11.0,
|
143 |
-
|
144 |
-
10.0,
|
145 |
-
11.100000381469727,
|
146 |
-
9.699999809265137,
|
147 |
-
10.5,
|
148 |
8.699999809265137,
|
149 |
-
9.600000381469727,
|
150 |
-
10.399999618530273,
|
151 |
11.0,
|
152 |
-
11.100000381469727,
|
153 |
-
10.800000190734863,
|
154 |
-
9.0,
|
155 |
-
10.0,
|
156 |
11.0,
|
157 |
-
10.
|
158 |
-
9.399999618530273,
|
159 |
-
9.699999809265137,
|
160 |
-
12.699999809265137,
|
161 |
9.0
|
162 |
],
|
163 |
"moe_predictions": [
|
164 |
-
11.
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
10.
|
169 |
-
|
170 |
-
|
171 |
-
9.
|
172 |
-
10.
|
173 |
-
12.966812133789062,
|
174 |
-
11.055685043334961,
|
175 |
13.093341827392578,
|
176 |
-
11.
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
11.135326385498047,
|
181 |
-
11.014484405517578,
|
182 |
-
10.392723083496094,
|
183 |
-
11.37826156616211,
|
184 |
-
10.060087203979492,
|
185 |
-
11.353907585144043,
|
186 |
-
10.72860050201416,
|
187 |
-
9.777619361877441,
|
188 |
-
9.150984764099121,
|
189 |
-
10.573850631713867,
|
190 |
-
10.46796989440918,
|
191 |
-
10.479241371154785,
|
192 |
-
9.75227165222168,
|
193 |
10.527164459228516,
|
194 |
-
|
195 |
-
|
196 |
-
9.
|
197 |
-
|
198 |
-
9.318197250366211,
|
199 |
-
10.484042167663574,
|
200 |
-
9.54578971862793,
|
201 |
-
10.413134574890137,
|
202 |
-
11.154340744018555,
|
203 |
-
13.079666137695312,
|
204 |
-
9.558942794799805,
|
205 |
-
11.153170585632324,
|
206 |
-
8.779823303222656,
|
207 |
-
11.030976295471191,
|
208 |
-
10.56929874420166,
|
209 |
-
11.015460968017578,
|
210 |
-
11.146952629089355,
|
211 |
-
11.136444091796875,
|
212 |
-
10.356411933898926,
|
213 |
-
11.381966590881348,
|
214 |
-
11.53759765625,
|
215 |
-
9.69221305847168,
|
216 |
-
10.891069412231445,
|
217 |
-
11.705709457397461,
|
218 |
-
10.507513999938965,
|
219 |
-
9.079387664794922,
|
220 |
-
9.473494529724121,
|
221 |
-
9.648874282836914,
|
222 |
-
11.7305908203125,
|
223 |
-
9.888289451599121,
|
224 |
-
9.338244438171387,
|
225 |
-
10.491485595703125,
|
226 |
-
10.797355651855469,
|
227 |
-
8.876679420471191,
|
228 |
-
12.945722579956055,
|
229 |
-
10.505922317504883,
|
230 |
-
9.545509338378906,
|
231 |
-
10.245137214660645,
|
232 |
-
10.609914779663086,
|
233 |
-
9.690855026245117,
|
234 |
-
9.788698196411133,
|
235 |
-
11.52328109741211,
|
236 |
-
10.893503189086914,
|
237 |
-
9.418478965759277,
|
238 |
-
11.218090057373047,
|
239 |
-
11.710685729980469,
|
240 |
-
10.888498306274414,
|
241 |
-
8.951180458068848,
|
242 |
-
9.556252479553223,
|
243 |
-
12.008685111999512,
|
244 |
-
11.203088760375977,
|
245 |
-
9.37525463104248,
|
246 |
-
9.686023712158203,
|
247 |
-
11.137346267700195,
|
248 |
-
10.356472969055176,
|
249 |
-
9.560345649719238,
|
250 |
-
11.539974212646484,
|
251 |
-
11.24638557434082,
|
252 |
-
9.592302322387695,
|
253 |
-
8.74775505065918,
|
254 |
-
10.552587509155273,
|
255 |
-
10.164124488830566,
|
256 |
-
10.536083221435547,
|
257 |
-
10.612926483154297,
|
258 |
-
10.58446979522705,
|
259 |
11.010236740112305,
|
260 |
-
10.
|
261 |
-
|
262 |
-
11.
|
263 |
-
11.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
10.694746017456055,
|
265 |
-
10.
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
9.
|
270 |
-
|
271 |
-
|
272 |
-
11.
|
273 |
-
|
274 |
-
11.
|
275 |
-
9.
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
10.
|
282 |
-
|
283 |
-
11.
|
284 |
-
10.
|
285 |
-
|
286 |
-
|
287 |
-
9.
|
288 |
-
|
289 |
-
11.
|
290 |
-
|
291 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
10.476083755493164,
|
293 |
-
|
294 |
-
9.
|
295 |
-
|
296 |
-
|
297 |
-
10.
|
298 |
-
|
299 |
-
10.
|
300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
11.228448867797852,
|
302 |
-
|
303 |
-
10.
|
304 |
-
11.
|
305 |
-
|
306 |
-
10.
|
307 |
-
|
308 |
-
|
309 |
-
10.
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
10.
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
|
|
|
|
|
|
|
|
|
|
321 |
],
|
322 |
"individual_predictions": {
|
323 |
"efficientnet_b3_transformer": [
|
324 |
-
11.
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
9.
|
331 |
-
9.
|
332 |
-
10.
|
333 |
-
13.305447578430176,
|
334 |
-
10.197638511657715,
|
335 |
13.537657737731934,
|
336 |
-
10.
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
10.548056602478027,
|
341 |
-
10.766114234924316,
|
342 |
-
10.293607711791992,
|
343 |
-
10.927001953125,
|
344 |
-
9.803337097167969,
|
345 |
-
11.071410179138184,
|
346 |
-
10.097264289855957,
|
347 |
-
9.165467262268066,
|
348 |
-
8.166515350341797,
|
349 |
-
10.0133056640625,
|
350 |
-
10.137511253356934,
|
351 |
-
9.890531539916992,
|
352 |
-
9.145689964294434,
|
353 |
10.485107421875,
|
354 |
-
|
355 |
-
|
356 |
-
9.
|
357 |
-
|
358 |
-
8.978877067565918,
|
359 |
-
10.143651962280273,
|
360 |
-
9.263312339782715,
|
361 |
-
10.041259765625,
|
362 |
-
10.457343101501465,
|
363 |
-
13.546338081359863,
|
364 |
-
9.288726806640625,
|
365 |
-
10.456021308898926,
|
366 |
-
8.490445137023926,
|
367 |
-
10.460243225097656,
|
368 |
-
10.012919425964355,
|
369 |
-
11.114548683166504,
|
370 |
-
10.548954963684082,
|
371 |
-
10.77907657623291,
|
372 |
-
10.15251350402832,
|
373 |
-
10.923174858093262,
|
374 |
-
11.296109199523926,
|
375 |
-
9.368083000183105,
|
376 |
-
10.545008659362793,
|
377 |
-
11.159947395324707,
|
378 |
-
10.038147926330566,
|
379 |
-
8.497147560119629,
|
380 |
-
9.207659721374512,
|
381 |
-
9.170109748840332,
|
382 |
-
11.221556663513184,
|
383 |
-
9.174721717834473,
|
384 |
-
8.752867698669434,
|
385 |
-
10.336318969726562,
|
386 |
-
10.116740226745605,
|
387 |
-
8.14444637298584,
|
388 |
-
13.291146278381348,
|
389 |
-
10.12454891204834,
|
390 |
-
9.043634414672852,
|
391 |
-
9.82880687713623,
|
392 |
-
9.841523170471191,
|
393 |
-
9.366087913513184,
|
394 |
-
9.41323471069336,
|
395 |
-
10.771563529968262,
|
396 |
-
10.565585136413574,
|
397 |
-
8.822549819946289,
|
398 |
-
11.126303672790527,
|
399 |
-
11.17785358428955,
|
400 |
-
10.847918510437012,
|
401 |
-
8.105504035949707,
|
402 |
-
9.042283058166504,
|
403 |
-
11.476466178894043,
|
404 |
-
10.669010162353516,
|
405 |
-
8.949850082397461,
|
406 |
-
9.371846199035645,
|
407 |
-
11.209992408752441,
|
408 |
-
10.284793853759766,
|
409 |
-
8.732993125915527,
|
410 |
-
10.731574058532715,
|
411 |
-
10.698369026184082,
|
412 |
-
8.777587890625,
|
413 |
-
8.237317085266113,
|
414 |
-
10.505911827087402,
|
415 |
-
9.840256690979004,
|
416 |
-
10.486929893493652,
|
417 |
-
10.697690963745117,
|
418 |
-
10.00699520111084,
|
419 |
10.793766975402832,
|
420 |
-
10.
|
421 |
-
|
422 |
-
10.
|
423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
10.037339210510254,
|
425 |
-
10.
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
9.
|
430 |
-
|
431 |
-
|
432 |
-
10.
|
433 |
-
|
434 |
-
10.
|
435 |
-
9.
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
10.
|
442 |
-
|
443 |
-
10.
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
9.
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
452 |
10.341578483581543,
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
10.
|
458 |
-
|
459 |
-
|
460 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
10.327948570251465,
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
10.
|
467 |
-
|
468 |
-
|
469 |
-
10.
|
470 |
-
10.
|
471 |
-
|
472 |
-
10.
|
473 |
-
|
474 |
-
9.
|
475 |
-
|
476 |
-
9.
|
477 |
-
9.
|
478 |
-
|
479 |
-
|
480 |
-
|
|
|
|
|
|
|
|
|
|
|
481 |
],
|
482 |
"efficientnet_b0_transformer": [
|
483 |
-
11.
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
9.
|
491 |
-
10.
|
492 |
-
13.499242782592773,
|
493 |
-
11.343120574951172,
|
494 |
12.953442573547363,
|
495 |
-
11.
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
11.39995002746582,
|
500 |
-
11.21767807006836,
|
501 |
-
10.430135726928711,
|
502 |
-
11.690134048461914,
|
503 |
-
9.993916511535645,
|
504 |
-
11.647773742675781,
|
505 |
-
11.226818084716797,
|
506 |
-
9.928828239440918,
|
507 |
-
9.873790740966797,
|
508 |
-
10.440296173095703,
|
509 |
-
10.689691543579102,
|
510 |
-
10.651750564575195,
|
511 |
-
10.012208938598633,
|
512 |
10.37149429321289,
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
9.647960662841797,
|
518 |
-
10.770721435546875,
|
519 |
-
9.662923812866211,
|
520 |
-
10.81811809539795,
|
521 |
-
11.476736068725586,
|
522 |
-
12.968710899353027,
|
523 |
-
9.738420486450195,
|
524 |
-
11.47037124633789,
|
525 |
-
8.632101058959961,
|
526 |
-
11.185698509216309,
|
527 |
-
11.003364562988281,
|
528 |
-
10.891831398010254,
|
529 |
-
11.404769897460938,
|
530 |
-
11.49870777130127,
|
531 |
-
10.478404998779297,
|
532 |
-
11.697516441345215,
|
533 |
-
11.908629417419434,
|
534 |
-
9.77428150177002,
|
535 |
-
11.29122543334961,
|
536 |
-
11.484548568725586,
|
537 |
-
10.938173294067383,
|
538 |
-
9.57394027709961,
|
539 |
-
9.642441749572754,
|
540 |
-
9.688291549682617,
|
541 |
-
11.521190643310547,
|
542 |
-
10.456705093383789,
|
543 |
-
9.57772159576416,
|
544 |
-
10.563447952270508,
|
545 |
-
11.08597469329834,
|
546 |
-
9.118146896362305,
|
547 |
-
13.47038745880127,
|
548 |
-
10.913671493530273,
|
549 |
-
9.929350852966309,
|
550 |
-
10.526603698730469,
|
551 |
-
10.606958389282227,
|
552 |
-
9.764165878295898,
|
553 |
-
10.084386825561523,
|
554 |
-
11.6922607421875,
|
555 |
-
11.027682304382324,
|
556 |
-
9.797820091247559,
|
557 |
-
11.257314682006836,
|
558 |
-
12.267354011535645,
|
559 |
-
10.73689079284668,
|
560 |
-
9.154512405395508,
|
561 |
-
9.921629905700684,
|
562 |
-
12.784350395202637,
|
563 |
-
11.669108390808105,
|
564 |
-
9.659965515136719,
|
565 |
-
9.74787712097168,
|
566 |
-
11.229676246643066,
|
567 |
-
10.430813789367676,
|
568 |
-
9.788354873657227,
|
569 |
-
11.721125602722168,
|
570 |
-
11.825557708740234,
|
571 |
-
9.755647659301758,
|
572 |
-
8.926406860351562,
|
573 |
-
10.426839828491211,
|
574 |
-
10.43403148651123,
|
575 |
-
10.416683197021484,
|
576 |
-
10.326852798461914,
|
577 |
-
10.440661430358887,
|
578 |
11.215356826782227,
|
579 |
-
|
580 |
-
|
581 |
-
11.
|
582 |
-
11.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
11.006742477416992,
|
584 |
-
10.
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
9.
|
589 |
-
|
590 |
-
|
591 |
-
11.
|
592 |
-
|
593 |
-
11.
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
11.
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
11.
|
609 |
-
|
610 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
611 |
10.568946838378906,
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
10.
|
619 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
620 |
11.805412292480469,
|
621 |
-
|
622 |
-
|
623 |
-
11.
|
624 |
-
|
625 |
-
10.
|
626 |
-
|
627 |
-
|
628 |
-
10.
|
629 |
-
11.
|
630 |
-
|
631 |
-
11.
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
10.
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
|
|
|
|
|
|
|
|
|
|
640 |
],
|
641 |
"resnet50_transformer": [
|
642 |
-
11.
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
10.
|
647 |
-
|
648 |
-
10.
|
649 |
-
|
650 |
-
|
651 |
-
12.095745086669922,
|
652 |
-
11.626296043395996,
|
653 |
12.788922309875488,
|
654 |
-
11.
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
11.45797348022461,
|
659 |
-
11.059659957885742,
|
660 |
-
10.454424858093262,
|
661 |
-
11.51764965057373,
|
662 |
-
10.38300609588623,
|
663 |
-
11.342537879943848,
|
664 |
-
10.86171817779541,
|
665 |
-
10.238561630249023,
|
666 |
-
9.412647247314453,
|
667 |
-
11.267950057983398,
|
668 |
-
10.576706886291504,
|
669 |
-
10.895441055297852,
|
670 |
-
10.098917007446289,
|
671 |
10.72489070892334,
|
672 |
-
12.
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
9.327754020690918,
|
677 |
-
10.537753105163574,
|
678 |
-
9.71113109588623,
|
679 |
-
10.380024909973145,
|
680 |
-
11.528943061828613,
|
681 |
-
12.723946571350098,
|
682 |
-
9.649679183959961,
|
683 |
-
11.53311824798584,
|
684 |
-
9.216923713684082,
|
685 |
-
11.446986198425293,
|
686 |
-
10.691610336303711,
|
687 |
-
11.040003776550293,
|
688 |
-
11.48713207244873,
|
689 |
-
11.131546974182129,
|
690 |
-
10.438315391540527,
|
691 |
-
11.525206565856934,
|
692 |
-
11.408055305480957,
|
693 |
-
9.934273719787598,
|
694 |
-
10.836973190307617,
|
695 |
-
12.472630500793457,
|
696 |
-
10.546219825744629,
|
697 |
-
9.167073249816895,
|
698 |
-
9.570382118225098,
|
699 |
-
10.088221549987793,
|
700 |
-
12.44902515411377,
|
701 |
-
10.033440589904785,
|
702 |
-
9.684144020080566,
|
703 |
-
10.574688911437988,
|
704 |
-
11.189352989196777,
|
705 |
-
9.367444038391113,
|
706 |
-
12.075634956359863,
|
707 |
-
10.479545593261719,
|
708 |
-
9.663542747497559,
|
709 |
-
10.379999160766602,
|
710 |
-
11.381260871887207,
|
711 |
-
9.942309379577637,
|
712 |
-
9.8684720993042,
|
713 |
-
12.106017112731934,
|
714 |
-
11.08724308013916,
|
715 |
-
9.635066986083984,
|
716 |
-
11.270651817321777,
|
717 |
-
11.686848640441895,
|
718 |
-
11.080682754516602,
|
719 |
-
9.593523979187012,
|
720 |
-
9.70484447479248,
|
721 |
-
11.765238761901855,
|
722 |
-
11.271148681640625,
|
723 |
-
9.515948295593262,
|
724 |
-
9.938346862792969,
|
725 |
-
10.972367286682129,
|
726 |
-
10.35381031036377,
|
727 |
-
10.159687995910645,
|
728 |
-
12.167220115661621,
|
729 |
-
11.215229034423828,
|
730 |
-
10.243671417236328,
|
731 |
-
9.07953929901123,
|
732 |
-
10.72500991821289,
|
733 |
-
10.218084335327148,
|
734 |
-
10.704636573791504,
|
735 |
-
10.81423568725586,
|
736 |
-
11.305752754211426,
|
737 |
11.021586418151855,
|
738 |
-
10.
|
739 |
-
11.
|
740 |
-
11.
|
741 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
742 |
11.040154457092285,
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
10.
|
748 |
-
|
749 |
-
|
750 |
-
11.
|
751 |
-
|
752 |
-
11.
|
753 |
-
9.
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
11.
|
762 |
-
11.
|
763 |
-
|
764 |
-
11.
|
765 |
-
9.
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
10.517725944519043,
|
771 |
-
|
772 |
-
9.
|
773 |
-
|
774 |
-
|
775 |
-
10.
|
776 |
-
|
777 |
-
10.
|
778 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
779 |
11.551984786987305,
|
780 |
-
|
781 |
-
10.
|
782 |
-
11.
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
10.
|
787 |
-
10.
|
788 |
-
11.
|
789 |
-
|
790 |
-
11.
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
10.
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
|
|
|
|
|
|
|
|
|
|
799 |
]
|
800 |
}
|
801 |
}
|
|
|
1 |
{
|
2 |
+
"moe_test_mae": 0.21137296557426452,
|
3 |
+
"moe_test_mse": 0.06364622553810477,
|
4 |
"true_labels": [
|
5 |
11.100000381469727,
|
6 |
+
10.5,
|
7 |
+
10.399999618530273,
|
|
|
|
|
8 |
8.699999809265137,
|
9 |
+
10.5,
|
10 |
+
10.399999618530273,
|
11 |
+
10.399999618530273,
|
12 |
9.600000381469727,
|
13 |
+
10.0,
|
|
|
14 |
12.699999809265137,
|
15 |
+
11.0,
|
16 |
10.899999618530273,
|
|
|
17 |
11.0,
|
|
|
18 |
8.699999809265137,
|
19 |
+
10.399999618530273,
|
20 |
11.600000381469727,
|
21 |
+
10.199999809265137,
|
22 |
+
10.0,
|
23 |
+
10.5,
|
24 |
11.0,
|
25 |
+
10.399999618530273,
|
26 |
+
10.5,
|
27 |
+
10.899999618530273,
|
28 |
11.0,
|
29 |
+
11.100000381469727,
|
30 |
+
12.699999809265137,
|
31 |
11.0,
|
|
|
32 |
11.100000381469727,
|
33 |
+
11.600000381469727,
|
34 |
+
10.800000190734863,
|
35 |
+
9.399999618530273,
|
36 |
+
11.100000381469727,
|
37 |
+
11.100000381469727,
|
38 |
+
10.800000190734863,
|
39 |
10.199999809265137,
|
40 |
+
9.399999618530273,
|
41 |
+
9.399999618530273,
|
|
|
|
|
42 |
12.699999809265137,
|
43 |
+
10.199999809265137,
|
44 |
+
11.100000381469727,
|
45 |
+
10.899999618530273,
|
46 |
+
10.399999618530273,
|
47 |
9.399999618530273,
|
48 |
+
11.0,
|
49 |
+
9.0,
|
50 |
+
9.0,
|
51 |
9.399999618530273,
|
52 |
+
10.5,
|
53 |
+
10.899999618530273,
|
54 |
+
10.5,
|
55 |
+
10.0,
|
56 |
9.399999618530273,
|
57 |
+
11.100000381469727,
|
58 |
9.399999618530273,
|
59 |
+
9.600000381469727,
|
|
|
|
|
60 |
9.399999618530273,
|
61 |
+
9.699999809265137,
|
|
|
62 |
10.800000190734863,
|
|
|
|
|
63 |
11.0,
|
64 |
+
11.0,
|
65 |
+
9.600000381469727,
|
66 |
+
8.699999809265137,
|
67 |
+
12.699999809265137,
|
68 |
+
9.399999618530273,
|
69 |
10.899999618530273,
|
70 |
+
10.199999809265137,
|
71 |
+
10.5,
|
72 |
+
10.399999618530273,
|
73 |
11.0,
|
74 |
+
10.199999809265137,
|
75 |
11.100000381469727,
|
76 |
+
12.699999809265137,
|
77 |
9.399999618530273,
|
|
|
|
|
78 |
10.300000190734863,
|
79 |
+
11.600000381469727,
|
80 |
+
8.699999809265137,
|
81 |
+
10.399999618530273,
|
82 |
+
11.0,
|
83 |
9.399999618530273,
|
84 |
+
10.199999809265137,
|
85 |
+
10.300000190734863,
|
86 |
+
11.0,
|
87 |
+
11.600000381469727,
|
88 |
+
10.5,
|
89 |
+
10.899999618530273,
|
90 |
9.399999618530273,
|
91 |
+
10.399999618530273,
|
92 |
11.600000381469727,
|
93 |
+
9.600000381469727,
|
94 |
9.399999618530273,
|
95 |
+
10.199999809265137,
|
96 |
10.399999618530273,
|
97 |
+
10.0,
|
98 |
10.300000190734863,
|
99 |
+
9.699999809265137,
|
100 |
+
11.100000381469727,
|
101 |
+
11.0,
|
102 |
+
9.0,
|
103 |
+
10.800000190734863,
|
104 |
+
9.399999618530273,
|
105 |
+
10.399999618530273,
|
106 |
+
8.699999809265137,
|
107 |
+
11.0,
|
108 |
+
11.0,
|
109 |
+
11.0,
|
110 |
8.699999809265137,
|
111 |
+
10.300000190734863,
|
112 |
+
9.600000381469727,
|
113 |
10.300000190734863,
|
114 |
9.399999618530273,
|
115 |
10.300000190734863,
|
116 |
+
10.899999618530273,
|
117 |
10.199999809265137,
|
|
|
|
|
118 |
11.600000381469727,
|
119 |
10.5,
|
120 |
+
10.0,
|
121 |
+
9.699999809265137,
|
122 |
11.0,
|
123 |
+
11.100000381469727,
|
124 |
+
10.199999809265137,
|
125 |
+
10.5,
|
126 |
+
11.100000381469727,
|
127 |
11.600000381469727,
|
128 |
11.0,
|
|
|
|
|
|
|
129 |
11.100000381469727,
|
|
|
|
|
|
|
130 |
10.300000190734863,
|
131 |
+
9.0,
|
132 |
+
9.399999618530273,
|
133 |
+
12.699999809265137,
|
134 |
9.699999809265137,
|
|
|
135 |
11.0,
|
136 |
9.699999809265137,
|
137 |
+
11.0,
|
138 |
+
11.100000381469727,
|
139 |
10.300000190734863,
|
|
|
|
|
|
|
140 |
11.0,
|
141 |
+
11.100000381469727,
|
142 |
+
10.199999809265137,
|
143 |
12.699999809265137,
|
|
|
|
|
|
|
144 |
10.300000190734863,
|
145 |
10.300000190734863,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
10.899999618530273,
|
147 |
+
9.0,
|
148 |
+
10.800000190734863,
|
149 |
+
11.0,
|
150 |
9.399999618530273,
|
151 |
9.0,
|
152 |
+
10.199999809265137,
|
|
|
153 |
10.300000190734863,
|
154 |
11.600000381469727,
|
|
|
|
|
155 |
11.0,
|
156 |
+
10.899999618530273,
|
|
|
|
|
|
|
|
|
157 |
8.699999809265137,
|
|
|
|
|
158 |
11.0,
|
|
|
|
|
|
|
|
|
159 |
11.0,
|
160 |
+
10.0,
|
|
|
|
|
|
|
161 |
9.0
|
162 |
],
|
163 |
"moe_predictions": [
|
164 |
+
11.49791431427002,
|
165 |
+
10.952095985412598,
|
166 |
+
10.454227447509766,
|
167 |
+
8.841472625732422,
|
168 |
+
10.891345977783203,
|
169 |
+
10.519970893859863,
|
170 |
+
10.5680513381958,
|
171 |
+
9.93174934387207,
|
172 |
+
10.139881134033203,
|
|
|
|
|
173 |
13.093341827392578,
|
174 |
+
11.227279663085938,
|
175 |
+
11.179691314697266,
|
176 |
+
11.202095031738281,
|
177 |
+
8.786151885986328,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
10.527164459228516,
|
179 |
+
12.075817108154297,
|
180 |
+
10.200088500976562,
|
181 |
+
9.931471824645996,
|
182 |
+
10.738975524902344,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
11.010236740112305,
|
184 |
+
10.453255653381348,
|
185 |
+
10.959787368774414,
|
186 |
+
11.017255783081055,
|
187 |
+
11.172292709350586,
|
188 |
+
11.556468963623047,
|
189 |
+
13.037904739379883,
|
190 |
+
11.040396690368652,
|
191 |
+
11.457777976989746,
|
192 |
+
11.602184295654297,
|
193 |
+
11.101509094238281,
|
194 |
+
9.761225700378418,
|
195 |
+
11.38801097869873,
|
196 |
+
11.591976165771484,
|
197 |
+
11.264935493469238,
|
198 |
+
10.394660949707031,
|
199 |
+
9.425639152526855,
|
200 |
+
9.4509859085083,
|
201 |
+
13.106525421142578,
|
202 |
+
10.34262466430664,
|
203 |
+
11.359064102172852,
|
204 |
+
11.14004898071289,
|
205 |
+
10.597884178161621,
|
206 |
+
9.612415313720703,
|
207 |
+
11.376269340515137,
|
208 |
+
8.872610092163086,
|
209 |
+
9.350934982299805,
|
210 |
+
9.771783828735352,
|
211 |
+
10.806012153625488,
|
212 |
+
11.032815933227539,
|
213 |
10.694746017456055,
|
214 |
+
10.307258605957031,
|
215 |
+
9.461359024047852,
|
216 |
+
11.560626983642578,
|
217 |
+
9.754105567932129,
|
218 |
+
9.918225288391113,
|
219 |
+
9.681318283081055,
|
220 |
+
9.560345649719238,
|
221 |
+
11.216781616210938,
|
222 |
+
11.11925983428955,
|
223 |
+
11.24638557434082,
|
224 |
+
9.823186874389648,
|
225 |
+
8.779823303222656,
|
226 |
+
11.989530563354492,
|
227 |
+
9.350080490112305,
|
228 |
+
11.18703842163086,
|
229 |
+
10.336519241333008,
|
230 |
+
10.776782989501953,
|
231 |
+
10.519142150878906,
|
232 |
+
11.191191673278809,
|
233 |
+
10.605438232421875,
|
234 |
+
11.429242134094238,
|
235 |
+
12.977052688598633,
|
236 |
+
9.54578971862793,
|
237 |
+
10.47386646270752,
|
238 |
+
11.556024551391602,
|
239 |
+
8.826037406921387,
|
240 |
+
10.459871292114258,
|
241 |
+
11.022876739501953,
|
242 |
+
9.60521411895752,
|
243 |
+
10.370050430297852,
|
244 |
+
10.628425598144531,
|
245 |
+
11.128847122192383,
|
246 |
+
11.716771125793457,
|
247 |
+
10.89390754699707,
|
248 |
+
11.02875804901123,
|
249 |
+
9.504777908325195,
|
250 |
10.476083755493164,
|
251 |
+
11.748279571533203,
|
252 |
+
9.797750473022461,
|
253 |
+
9.668087005615234,
|
254 |
+
10.459554672241211,
|
255 |
+
10.612926483154297,
|
256 |
+
10.08256721496582,
|
257 |
+
10.368606567382812,
|
258 |
+
9.684417724609375,
|
259 |
+
11.16148567199707,
|
260 |
+
11.225208282470703,
|
261 |
+
9.4158353805542,
|
262 |
+
10.983354568481445,
|
263 |
+
9.450948715209961,
|
264 |
+
10.536083221435547,
|
265 |
+
9.055654525756836,
|
266 |
+
11.21628189086914,
|
267 |
+
11.220507621765137,
|
268 |
+
11.284944534301758,
|
269 |
+
8.917679786682129,
|
270 |
+
10.463410377502441,
|
271 |
+
9.913228988647461,
|
272 |
+
10.490144729614258,
|
273 |
+
9.375974655151367,
|
274 |
+
10.407944679260254,
|
275 |
+
11.09685230255127,
|
276 |
+
10.541641235351562,
|
277 |
+
11.729219436645508,
|
278 |
+
10.70352554321289,
|
279 |
+
9.881623268127441,
|
280 |
+
9.759466171264648,
|
281 |
+
11.364102363586426,
|
282 |
+
11.522855758666992,
|
283 |
+
10.19462776184082,
|
284 |
+
10.618962287902832,
|
285 |
+
11.154468536376953,
|
286 |
+
11.539796829223633,
|
287 |
+
11.23081111907959,
|
288 |
+
11.561714172363281,
|
289 |
+
10.671709060668945,
|
290 |
+
9.418478965759277,
|
291 |
+
9.375926971435547,
|
292 |
+
13.051578521728516,
|
293 |
+
9.512340545654297,
|
294 |
+
11.298563003540039,
|
295 |
+
9.679695129394531,
|
296 |
11.228448867797852,
|
297 |
+
11.607831001281738,
|
298 |
+
10.620326042175293,
|
299 |
+
11.257329940795898,
|
300 |
+
11.506999969482422,
|
301 |
+
10.40395736694336,
|
302 |
+
12.950227737426758,
|
303 |
+
10.369912147521973,
|
304 |
+
10.432703018188477,
|
305 |
+
10.929553031921387,
|
306 |
+
9.103975296020508,
|
307 |
+
10.956567764282227,
|
308 |
+
11.215112686157227,
|
309 |
+
9.548199653625488,
|
310 |
+
9.123867988586426,
|
311 |
+
10.550899505615234,
|
312 |
+
10.245137214660645,
|
313 |
+
12.018054962158203,
|
314 |
+
11.03477668762207,
|
315 |
+
10.958497047424316,
|
316 |
+
8.761012077331543,
|
317 |
+
11.12636661529541,
|
318 |
+
10.795982360839844,
|
319 |
+
10.263906478881836,
|
320 |
+
9.013847351074219
|
321 |
],
|
322 |
"individual_predictions": {
|
323 |
"efficientnet_b3_transformer": [
|
324 |
+
11.011456489562988,
|
325 |
+
10.437052726745605,
|
326 |
+
10.261249542236328,
|
327 |
+
7.985320568084717,
|
328 |
+
10.548121452331543,
|
329 |
+
10.492411613464355,
|
330 |
+
9.917695045471191,
|
331 |
+
9.54853630065918,
|
332 |
+
10.076766014099121,
|
|
|
|
|
333 |
13.537657737731934,
|
334 |
+
10.326626777648926,
|
335 |
+
10.585708618164062,
|
336 |
+
11.172317504882812,
|
337 |
+
8.144732475280762,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
10.485107421875,
|
339 |
+
11.6995210647583,
|
340 |
+
10.108969688415527,
|
341 |
+
9.243327140808105,
|
342 |
+
10.04570198059082,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
10.793766975402832,
|
344 |
+
10.254855155944824,
|
345 |
+
10.422723770141602,
|
346 |
+
10.870402336120605,
|
347 |
+
10.91348648071289,
|
348 |
+
11.096152305603027,
|
349 |
+
13.936193466186523,
|
350 |
+
10.705317497253418,
|
351 |
+
11.00967788696289,
|
352 |
+
10.99274730682373,
|
353 |
+
10.733809471130371,
|
354 |
+
9.175597190856934,
|
355 |
+
11.046974182128906,
|
356 |
+
11.347891807556152,
|
357 |
+
10.613112449645996,
|
358 |
+
10.023240089416504,
|
359 |
+
9.056133270263672,
|
360 |
+
9.2033109664917,
|
361 |
+
13.54947566986084,
|
362 |
+
9.860166549682617,
|
363 |
+
11.063033103942871,
|
364 |
+
10.598092079162598,
|
365 |
+
10.6638765335083,
|
366 |
+
9.17311954498291,
|
367 |
+
10.922500610351562,
|
368 |
+
7.99126672744751,
|
369 |
+
8.643234252929688,
|
370 |
+
9.155375480651855,
|
371 |
+
10.310547828674316,
|
372 |
+
11.133363723754883,
|
373 |
10.037339210510254,
|
374 |
+
10.077462196350098,
|
375 |
+
9.141955375671387,
|
376 |
+
11.109526634216309,
|
377 |
+
9.145268440246582,
|
378 |
+
9.562047004699707,
|
379 |
+
9.357654571533203,
|
380 |
+
8.732993125915527,
|
381 |
+
10.703978538513184,
|
382 |
+
10.722399711608887,
|
383 |
+
10.698369026184082,
|
384 |
+
9.570420265197754,
|
385 |
+
8.490445137023926,
|
386 |
+
11.466019630432129,
|
387 |
+
9.414340019226074,
|
388 |
+
10.59233283996582,
|
389 |
+
9.879103660583496,
|
390 |
+
10.255993843078613,
|
391 |
+
10.48453140258789,
|
392 |
+
10.90799331665039,
|
393 |
+
9.857056617736816,
|
394 |
+
10.97396183013916,
|
395 |
+
14.010629653930664,
|
396 |
+
9.263312339782715,
|
397 |
+
10.15234088897705,
|
398 |
+
10.73508358001709,
|
399 |
+
8.343344688415527,
|
400 |
+
10.253409385681152,
|
401 |
+
10.793999671936035,
|
402 |
+
9.331345558166504,
|
403 |
+
9.994551658630371,
|
404 |
+
10.216073989868164,
|
405 |
+
10.728191375732422,
|
406 |
+
10.56017780303955,
|
407 |
+
10.607600212097168,
|
408 |
+
10.643799781799316,
|
409 |
+
9.042943000793457,
|
410 |
10.341578483581543,
|
411 |
+
11.196541786193848,
|
412 |
+
9.367315292358398,
|
413 |
+
9.333880424499512,
|
414 |
+
10.117321014404297,
|
415 |
+
10.697690963745117,
|
416 |
+
9.582906723022461,
|
417 |
+
10.153056144714355,
|
418 |
+
9.058443069458008,
|
419 |
+
10.559529304504395,
|
420 |
+
11.073603630065918,
|
421 |
+
8.8185396194458,
|
422 |
+
10.699006080627441,
|
423 |
+
9.211636543273926,
|
424 |
+
10.486929893493652,
|
425 |
+
8.220829963684082,
|
426 |
+
11.156848907470703,
|
427 |
+
11.063627243041992,
|
428 |
+
11.050981521606445,
|
429 |
+
8.10926628112793,
|
430 |
+
10.373404502868652,
|
431 |
+
9.924508094787598,
|
432 |
+
10.186086654663086,
|
433 |
+
9.481890678405762,
|
434 |
+
10.31225872039795,
|
435 |
+
10.174295425415039,
|
436 |
+
9.873467445373535,
|
437 |
+
10.537038803100586,
|
438 |
+
10.269898414611816,
|
439 |
+
9.228285789489746,
|
440 |
+
9.133694648742676,
|
441 |
+
10.917866706848145,
|
442 |
+
11.04175853729248,
|
443 |
+
10.109822273254395,
|
444 |
+
10.328956604003906,
|
445 |
+
10.515660285949707,
|
446 |
+
10.732501029968262,
|
447 |
+
11.081313133239746,
|
448 |
+
11.12901782989502,
|
449 |
+
10.229890823364258,
|
450 |
+
8.822549819946289,
|
451 |
+
9.504118919372559,
|
452 |
+
13.927513122558594,
|
453 |
+
8.89388656616211,
|
454 |
+
11.0648775100708,
|
455 |
+
9.071036338806152,
|
456 |
10.327948570251465,
|
457 |
+
11.319812774658203,
|
458 |
+
10.036575317382812,
|
459 |
+
10.70290470123291,
|
460 |
+
11.069836616516113,
|
461 |
+
10.021210670471191,
|
462 |
+
13.740641593933105,
|
463 |
+
10.256255149841309,
|
464 |
+
10.28779125213623,
|
465 |
+
10.00243854522705,
|
466 |
+
8.478795051574707,
|
467 |
+
10.25095272064209,
|
468 |
+
10.321993827819824,
|
469 |
+
9.290078163146973,
|
470 |
+
8.640447616577148,
|
471 |
+
9.860431671142578,
|
472 |
+
9.82880687713623,
|
473 |
+
11.69638729095459,
|
474 |
+
10.707640647888184,
|
475 |
+
11.018778800964355,
|
476 |
+
8.396665573120117,
|
477 |
+
10.726140975952148,
|
478 |
+
10.567301750183105,
|
479 |
+
10.008172035217285,
|
480 |
+
8.390426635742188
|
481 |
],
|
482 |
"efficientnet_b0_transformer": [
|
483 |
+
11.743178367614746,
|
484 |
+
11.17111873626709,
|
485 |
+
10.41269588470459,
|
486 |
+
8.855524063110352,
|
487 |
+
11.296384811401367,
|
488 |
+
10.395981788635254,
|
489 |
+
11.416858673095703,
|
490 |
+
9.948115348815918,
|
491 |
+
10.613225936889648,
|
|
|
|
|
492 |
12.953442573547363,
|
493 |
+
11.799053192138672,
|
494 |
+
11.209972381591797,
|
495 |
+
11.255814552307129,
|
496 |
+
8.98547649383545,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
10.37149429321289,
|
498 |
+
12.042634963989258,
|
499 |
+
10.426054954528809,
|
500 |
+
10.467799186706543,
|
501 |
+
11.147850036621094,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
502 |
11.215356826782227,
|
503 |
+
10.1926908493042,
|
504 |
+
11.156776428222656,
|
505 |
+
11.019290924072266,
|
506 |
+
11.22017765045166,
|
507 |
+
11.9966402053833,
|
508 |
+
13.037962913513184,
|
509 |
+
11.350994110107422,
|
510 |
+
11.969884872436523,
|
511 |
+
11.721773147583008,
|
512 |
+
11.174083709716797,
|
513 |
+
10.404436111450195,
|
514 |
+
11.813179969787598,
|
515 |
+
11.945684432983398,
|
516 |
+
11.306056022644043,
|
517 |
+
10.361102104187012,
|
518 |
+
9.71973705291748,
|
519 |
+
9.618285179138184,
|
520 |
+
12.975137710571289,
|
521 |
+
10.384243965148926,
|
522 |
+
11.663352966308594,
|
523 |
+
11.203901290893555,
|
524 |
+
10.370718002319336,
|
525 |
+
9.658828735351562,
|
526 |
+
11.683477401733398,
|
527 |
+
9.227752685546875,
|
528 |
+
9.650102615356445,
|
529 |
+
9.925799369812012,
|
530 |
+
11.434671401977539,
|
531 |
+
10.895241737365723,
|
532 |
11.006742477416992,
|
533 |
+
10.917248725891113,
|
534 |
+
9.784621238708496,
|
535 |
+
12.000340461730957,
|
536 |
+
9.91793155670166,
|
537 |
+
9.919336318969727,
|
538 |
+
9.762454986572266,
|
539 |
+
9.788354873657227,
|
540 |
+
11.466252326965332,
|
541 |
+
11.405159950256348,
|
542 |
+
11.825557708740234,
|
543 |
+
10.0393705368042,
|
544 |
+
8.632101058959961,
|
545 |
+
12.782363891601562,
|
546 |
+
9.142356872558594,
|
547 |
+
11.228084564208984,
|
548 |
+
10.386346817016602,
|
549 |
+
11.36672592163086,
|
550 |
+
10.397486686706543,
|
551 |
+
11.256900787353516,
|
552 |
+
10.60472297668457,
|
553 |
+
11.874197959899902,
|
554 |
+
13.163078308105469,
|
555 |
+
9.662923812866211,
|
556 |
+
10.8616361618042,
|
557 |
+
11.691142082214355,
|
558 |
+
8.865287780761719,
|
559 |
+
10.207244873046875,
|
560 |
+
11.217007637023926,
|
561 |
+
9.747726440429688,
|
562 |
+
10.017398834228516,
|
563 |
+
10.834165573120117,
|
564 |
+
11.409814834594727,
|
565 |
+
12.362707138061523,
|
566 |
+
11.009987831115723,
|
567 |
+
11.278557777404785,
|
568 |
+
9.663545608520508,
|
569 |
10.568946838378906,
|
570 |
+
11.553452491760254,
|
571 |
+
10.085470199584961,
|
572 |
+
9.76612377166748,
|
573 |
+
10.628089904785156,
|
574 |
+
10.326852798461914,
|
575 |
+
10.3833646774292,
|
576 |
+
10.480897903442383,
|
577 |
+
9.789970397949219,
|
578 |
+
11.70141887664795,
|
579 |
+
11.112765312194824,
|
580 |
+
9.728450775146484,
|
581 |
+
10.885799407958984,
|
582 |
+
9.622087478637695,
|
583 |
+
10.416683197021484,
|
584 |
+
9.108359336853027,
|
585 |
+
11.237686157226562,
|
586 |
+
11.057950019836426,
|
587 |
+
11.098541259765625,
|
588 |
+
8.81431770324707,
|
589 |
+
10.602710723876953,
|
590 |
+
9.889699935913086,
|
591 |
+
10.752220153808594,
|
592 |
+
9.227273941040039,
|
593 |
+
10.543593406677246,
|
594 |
+
11.358682632446289,
|
595 |
+
10.906055450439453,
|
596 |
+
12.400298118591309,
|
597 |
+
10.981484413146973,
|
598 |
+
10.381155014038086,
|
599 |
+
9.965232849121094,
|
600 |
+
11.671711921691895,
|
601 |
+
12.028018951416016,
|
602 |
+
10.433465957641602,
|
603 |
+
11.049814224243164,
|
604 |
+
11.682543754577637,
|
605 |
+
11.715887069702148,
|
606 |
+
11.116255760192871,
|
607 |
+
12.003594398498535,
|
608 |
+
10.83981704711914,
|
609 |
+
9.797820091247559,
|
610 |
+
9.214962005615234,
|
611 |
+
13.022693634033203,
|
612 |
+
9.354233741760254,
|
613 |
+
11.115297317504883,
|
614 |
+
9.794788360595703,
|
615 |
11.805412292480469,
|
616 |
+
11.982343673706055,
|
617 |
+
11.402397155761719,
|
618 |
+
11.819561004638672,
|
619 |
+
11.99135971069336,
|
620 |
+
10.365850448608398,
|
621 |
+
12.891124725341797,
|
622 |
+
10.414666175842285,
|
623 |
+
10.618444442749023,
|
624 |
+
11.423562049865723,
|
625 |
+
9.560630798339844,
|
626 |
+
11.432249069213867,
|
627 |
+
11.787288665771484,
|
628 |
+
9.746140480041504,
|
629 |
+
9.39014720916748,
|
630 |
+
10.900354385375977,
|
631 |
+
10.526603698730469,
|
632 |
+
12.281966209411621,
|
633 |
+
11.33869743347168,
|
634 |
+
10.862354278564453,
|
635 |
+
8.576208114624023,
|
636 |
+
11.404010772705078,
|
637 |
+
10.769918441772461,
|
638 |
+
10.90639877319336,
|
639 |
+
8.992664337158203
|
640 |
],
|
641 |
"resnet50_transformer": [
|
642 |
+
11.739107131958008,
|
643 |
+
11.248116493225098,
|
644 |
+
10.688735008239746,
|
645 |
+
9.683572769165039,
|
646 |
+
10.829529762268066,
|
647 |
+
10.671517372131348,
|
648 |
+
10.369599342346191,
|
649 |
+
10.298595428466797,
|
650 |
+
9.72965145111084,
|
|
|
|
|
651 |
12.788922309875488,
|
652 |
+
11.556159019470215,
|
653 |
+
11.743390083312988,
|
654 |
+
11.178153038024902,
|
655 |
+
9.228245735168457,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
656 |
10.72489070892334,
|
657 |
+
12.4852933883667,
|
658 |
+
10.065241813659668,
|
659 |
+
10.08328914642334,
|
660 |
+
11.0233736038208,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
11.021586418151855,
|
662 |
+
10.91222095489502,
|
663 |
+
11.299861907958984,
|
664 |
+
11.16207218170166,
|
665 |
+
11.38321304321289,
|
666 |
+
11.576613426208496,
|
667 |
+
12.139554023742676,
|
668 |
+
11.0648775100708,
|
669 |
+
11.393771171569824,
|
670 |
+
12.092029571533203,
|
671 |
+
11.39663314819336,
|
672 |
+
9.703642845153809,
|
673 |
+
11.303877830505371,
|
674 |
+
11.482352256774902,
|
675 |
+
11.875636100769043,
|
676 |
+
10.799639701843262,
|
677 |
+
9.501046180725098,
|
678 |
+
9.531359672546387,
|
679 |
+
12.794964790344238,
|
680 |
+
10.783464431762695,
|
681 |
+
11.350804328918457,
|
682 |
+
11.618151664733887,
|
683 |
+
10.75905704498291,
|
684 |
+
10.005297660827637,
|
685 |
+
11.52283000946045,
|
686 |
+
9.398808479309082,
|
687 |
+
9.759465217590332,
|
688 |
+
10.234177589416504,
|
689 |
+
10.672816276550293,
|
690 |
+
11.069842338562012,
|
691 |
11.040154457092285,
|
692 |
+
9.9270658493042,
|
693 |
+
9.457501411437988,
|
694 |
+
11.572014808654785,
|
695 |
+
10.199116706848145,
|
696 |
+
10.27329158782959,
|
697 |
+
9.923844337463379,
|
698 |
+
10.159687995910645,
|
699 |
+
11.480114936828613,
|
700 |
+
11.230217933654785,
|
701 |
+
11.215229034423828,
|
702 |
+
9.859766960144043,
|
703 |
+
9.216923713684082,
|
704 |
+
11.720208168029785,
|
705 |
+
9.493544578552246,
|
706 |
+
11.740694999694824,
|
707 |
+
10.74410629272461,
|
708 |
+
10.707627296447754,
|
709 |
+
10.675408363342285,
|
710 |
+
11.40868091583252,
|
711 |
+
11.354533195495605,
|
712 |
+
11.43956470489502,
|
713 |
+
11.75744915008545,
|
714 |
+
9.71113109588623,
|
715 |
+
10.407622337341309,
|
716 |
+
12.241848945617676,
|
717 |
+
9.269479751586914,
|
718 |
+
10.918959617614746,
|
719 |
+
11.057621955871582,
|
720 |
+
9.73656940460205,
|
721 |
+
11.098200798034668,
|
722 |
+
10.835038185119629,
|
723 |
+
11.248536109924316,
|
724 |
+
12.22742748260498,
|
725 |
+
11.064131736755371,
|
726 |
+
11.16391658782959,
|
727 |
+
9.807845115661621,
|
728 |
10.517725944519043,
|
729 |
+
12.494842529296875,
|
730 |
+
9.94046688079834,
|
731 |
+
9.904257774353027,
|
732 |
+
10.63325023651123,
|
733 |
+
10.81423568725586,
|
734 |
+
10.281428337097168,
|
735 |
+
10.4718656539917,
|
736 |
+
10.204838752746582,
|
737 |
+
11.22350788116455,
|
738 |
+
11.48925495147705,
|
739 |
+
9.700515747070312,
|
740 |
+
11.365256309509277,
|
741 |
+
9.519120216369629,
|
742 |
+
10.704636573791504,
|
743 |
+
9.837773323059082,
|
744 |
+
11.25430965423584,
|
745 |
+
11.539944648742676,
|
746 |
+
11.705309867858887,
|
747 |
+
9.82945442199707,
|
748 |
+
10.414114952087402,
|
749 |
+
9.925477027893066,
|
750 |
+
10.532126426696777,
|
751 |
+
9.418757438659668,
|
752 |
+
10.367980003356934,
|
753 |
+
11.75757884979248,
|
754 |
+
10.845398902893066,
|
755 |
+
12.250321388244629,
|
756 |
+
10.859190940856934,
|
757 |
+
10.035428047180176,
|
758 |
+
10.179471969604492,
|
759 |
+
11.502727508544922,
|
760 |
+
11.498787879943848,
|
761 |
+
10.040594100952148,
|
762 |
+
10.478116035461426,
|
763 |
+
11.265198707580566,
|
764 |
+
12.171003341674805,
|
765 |
+
11.49486255645752,
|
766 |
+
11.552530288696289,
|
767 |
+
10.945416450500488,
|
768 |
+
9.635066986083984,
|
769 |
+
9.408698081970215,
|
770 |
+
12.204529762268066,
|
771 |
+
10.288901329040527,
|
772 |
+
11.7155122756958,
|
773 |
+
10.173260688781738,
|
774 |
11.551984786987305,
|
775 |
+
11.521336555480957,
|
776 |
+
10.422005653381348,
|
777 |
+
11.249524116516113,
|
778 |
+
11.459802627563477,
|
779 |
+
10.824810981750488,
|
780 |
+
12.218913078308105,
|
781 |
+
10.438814163208008,
|
782 |
+
10.391874313354492,
|
783 |
+
11.362658500671387,
|
784 |
+
9.272500991821289,
|
785 |
+
11.186502456665039,
|
786 |
+
11.536055564880371,
|
787 |
+
9.608378410339355,
|
788 |
+
9.341008186340332,
|
789 |
+
10.891911506652832,
|
790 |
+
10.379999160766602,
|
791 |
+
12.075809478759766,
|
792 |
+
11.057991027832031,
|
793 |
+
10.994357109069824,
|
794 |
+
9.310161590576172,
|
795 |
+
11.248947143554688,
|
796 |
+
11.050725936889648,
|
797 |
+
9.87714958190918,
|
798 |
+
9.658448219299316
|
799 |
]
|
800 |
}
|
801 |
}
|
requirements.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
torch>=2.
|
2 |
-
torchaudio>=2.
|
3 |
-
torchvision>=0.
|
4 |
-
gradio>=
|
5 |
-
numpy>=
|
6 |
-
pillow>=
|
7 |
-
tensorboard>=2.
|
8 |
pydantic==2.10.6
|
|
|
1 |
+
torch>=2.0.0
|
2 |
+
torchaudio>=2.0.0
|
3 |
+
torchvision>=0.15.0
|
4 |
+
gradio>=3.50.0
|
5 |
+
numpy>=1.20.0
|
6 |
+
pillow>=9.0.0
|
7 |
+
tensorboard>=2.12.0
|
8 |
pydantic==2.10.6
|