correction suppression modele yolo
This commit is contained in:
@@ -363,47 +363,6 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
return detectedImpacts.length;
|
||||
}
|
||||
|
||||
/// Auto-detect impacts using YOLOv8 model
|
||||
Future<int> autoDetectImpactsWithYOLO({bool clearExisting = false}) async {
|
||||
if (_imagePath == null || _targetType == null) return 0;
|
||||
|
||||
try {
|
||||
final detectedImpacts = await _detectionService.detectImpactsWithYOLO(
|
||||
_imagePath!,
|
||||
_targetType!,
|
||||
_targetCenterX,
|
||||
_targetCenterY,
|
||||
_targetRadius,
|
||||
_ringCount,
|
||||
);
|
||||
|
||||
if (clearExisting) {
|
||||
_shots.clear();
|
||||
}
|
||||
|
||||
// Add detected impacts as shots
|
||||
for (final impact in detectedImpacts) {
|
||||
final shot = Shot(
|
||||
id: _uuid.v4(),
|
||||
x: impact.x,
|
||||
y: impact.y,
|
||||
score: impact.suggestedScore,
|
||||
sessionId: '',
|
||||
);
|
||||
_shots.add(shot);
|
||||
}
|
||||
|
||||
_recalculateScores();
|
||||
_recalculateGrouping();
|
||||
notifyListeners();
|
||||
|
||||
return detectedImpacts.length;
|
||||
} catch (e) {
|
||||
print('Error in YOLO auto-detection: $e');
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// Detect impacts with OpenCV using reference points
|
||||
Future<int> detectFromReferencesWithOpenCV({
|
||||
double tolerance = 2.0,
|
||||
|
||||
@@ -1050,72 +1050,6 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// YOLO option button
|
||||
Card(
|
||||
color: AppTheme.primaryColor.withAlpha(25),
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.psychology, color: AppTheme.primaryColor),
|
||||
title: const Text('IA Detection (YOLOv8)', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
subtitle: const Text('Détection intelligente via modèle entraîné'),
|
||||
onTap: () async {
|
||||
Navigator.pop(context);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Text('Détection IA en cours...'),
|
||||
],
|
||||
),
|
||||
duration: Duration(seconds: 10),
|
||||
),
|
||||
);
|
||||
|
||||
final count = await provider.autoDetectImpactsWithYOLO(
|
||||
clearExisting: clearExisting,
|
||||
);
|
||||
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
count > 0
|
||||
? '$count impact(s) détecté(s) par l\'IA'
|
||||
: 'Aucun impact détecté par l\'IA.',
|
||||
),
|
||||
backgroundColor: count > 0
|
||||
? AppTheme.successColor
|
||||
: AppTheme.warningColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(child: Divider()),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Text('OU', style: TextStyle(color: Colors.grey, fontSize: 12)),
|
||||
),
|
||||
Expanded(child: Divider()),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const Text(
|
||||
'Détection Classique (Paramétrable):',
|
||||
|
||||
Reference in New Issue
Block a user