Upload app.py
Browse files
app.py
CHANGED
|
@@ -76,7 +76,11 @@ class SimpleVideoAnalyzer:
|
|
| 76 |
|
| 77 |
# Simple similarity-based prediction
|
| 78 |
# In a real implementation, you'd use a trained classifier
|
| 79 |
-
scores
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
# Get top 5 predictions
|
| 82 |
top_indices = np.argsort(scores)[-5:][::-1]
|
|
|
|
| 76 |
|
| 77 |
# Simple similarity-based prediction
|
| 78 |
# In a real implementation, you'd use a trained classifier
|
| 79 |
+
# Generate random scores and apply softmax manually
|
| 80 |
+
raw_scores = np.random.randn(len(self.action_categories))
|
| 81 |
+
# Manual softmax implementation
|
| 82 |
+
exp_scores = np.exp(raw_scores - np.max(raw_scores)) # Subtract max for numerical stability
|
| 83 |
+
scores = exp_scores / np.sum(exp_scores)
|
| 84 |
|
| 85 |
# Get top 5 predictions
|
| 86 |
top_indices = np.argsort(scores)[-5:][::-1]
|