Just change the setting optimize it for FPS pleas and thank you make it for low end…
- User
Just change the setting optimize it for FPS pleas and thank you make it for low end devices like only changing fps and no prediction
--- YOLO SINGLETON ---
class YOLOEnsemble: _instance = None _lock = threading.Lock()
def __init__(self, models_config): self.models = [] self.names = {} self.prediction_cache = {} self.cache_lock = threading.Lock() self.device = self._setup_directml_device() self._load_models(models_config) def _setup_directml_device(self): """Setup DirectML for maximum AMD GPU performance with fallbacks""" try: # Try DirectML first if torch_directml.is_available(): device_count = torch_directml.device_count() logging.info(f"DirectML available with {device_count} device(s)") if device_count > 0: # Get the best DirectML device (usually 0) dml_device = torch_directml.device(0) # Maximum DirectML optimizations torch.backends.directml.enabled = True torch.backends.directml.allow_reduced_precision = True logging.info(f"DirectML device initialized: {dml_device}") return dml_device # Fallback to CUDA if available if torch.cuda.is_available(): cuda_device = torch.device('cuda:0') logging.info(f"CUDA device initialized: {cuda_device}") return cuda_device # Final fallback to CPU with warning logging.warning("No GPU available, falling back to CPU (performance will be reduced)") return torch.device('cpu') except Exception as e: logging.warning(f"GPU setup failed ({e}), falling back to CPU") return torch.device('cpu') def _load_models(self, models_config): """Load models with DirectML optimization for maximum performance""" for model_path, imgsz in models_config: try: # Load YOLO model model = YOLO(model_path) # Force model to DirectML device for 100% GPU utilization model.model = model.model.to(self.device) # Set model to evaluation mode and optimize model.model.eval() # Enable DirectML optimizations if hasattr(torch.backends, 'directml') and torch.backends.directml.enabled: # Compile model for maximum DirectML performance try: model.model = torch.jit.optimize_for_inference(model.model) logging.info(f"Model JIT optimized for DirectML: {model_path}") except: logging.info(f"JIT optimization skipped for: {model_path}") # Zero-latency warmup with DirectML - more aggressive dummy = torch.zeros((1, 3, imgsz, imgsz), dtype=torch.float32, device=self.device) with torch.no_grad(): # More aggressive warmup - 15 iterations for maximum DirectML optimization for _ in range(15): try: _ = model.model(dummy) except: # Fallback warmup using predict dummy_np = np.zeros((imgsz, imgsz, 3), dtype=np.uint8) model.predict( source=dummy_np, imgsz=imgsz, device=self.device, verbose=False, stream=False ) break # Clear cache for maximum performance (if DirectML available) if hasattr(torch, 'directml') and str(self.device).startswith('privateuseone'): torch.directml.empty_cache() elif torch.cuda.is_available() and self.device.type == 'cuda': torch.cuda.empty_cache() self.models.append((model, imgsz)) if hasattr(model, "names"): self.names.update(model.names) logging.info(f"DirectML model loaded: {model_path} -> {imgsz}px on {self.device}") except Exception as e: logging.error(f"Failed to load model {model_path}: {e}") def predict(self, frame, conf_thres=0.3): """Ultra-high performance DirectML prediction with zero latency""" all_results = [] original_height, original_width = frame.shape[:2] # Process all models with DirectML for maximum GPU utilization with torch.no_grad(): # Disable gradients for inference speed for model, imgsz in self.models: try: # Calculate scale factors for coordinate transformation scale_x = original_width / imgsz scale_y = original_height / imgsz # Ultra-fast resize with optimized interpolation resized_frame = cv2.resize(frame, (imgsz, imgsz), interpolation=cv2.INTER_LINEAR) # Maximum performance prediction with DirectML results = model.predict( source=resized_frame, save=False, imgsz=imgsz, conf=conf_thres, iou=0.15, # More aggressive NMS for speed device=self.device, half=False, # DirectML works better with float32 verbose=False, stream=False, agnostic_nms=True, max_det=40, # Slightly higher detection count classes=[0], # Person class only retina_masks=False )[0] # Store transformation data results.scale_x = scale_x results.scale_y = scale_y results.original_width = original_width results.original_height = original_height all_results.append(results) except Exception as e: logging.warning(f"DirectML prediction failed: {e}") continue # No cache clearing to maintain maximum GPU utilization # Only clear if memory is getting full if hasattr(torch, 'directml') and str(self.device).startswith('privateuseone'): pass # Keep DirectML memory allocated elif torch.cuda.is_available() and self.device.type == 'cuda': pass # Keep CUDA memory allocated return all_results @classmethod def get_instance(cls, models_config): with cls._lock: if cls._instance is None: cls._instance = YOLOEnsemble(models_config) return cls._instance - Assistant
- User
FPS cap should be 90
- Assistant
Got it! To cap the FPS to 90 instead of 10, just set
target_fps = 90in therunmethod. Here's the minimal snippet change:target_fps = 90 # Changed from 10 to 90 frame_time = 1.0 / target_fps
Full snippet with FPS = 90:
def run(self): """Main detection loop with BitBlt capture and DirectML, optimized for low-end fps only""" self.running = True if not self.yolo_ensemble.models: logging.error("No models loaded") return if not self.setup_bitblt(): logging.error("BitBlt setup failed") return # Use only the smallest model for speed: assume first loaded model is smallest main_model, main_imgsz = self.yolo_ensemble.models[0] # Get screen dimensions self.screen_width = self.user32.GetSystemMetrics(0) # SM_CXSCREEN self.screen_height = self.user32.GetSystemMetrics(1) # SM_CYSCREEN self.center_x = self.screen_width >> 1 self.center_y = self.screen_height >> 1 logging.info(f"BitBlt detection started: {self.screen_width}x{self.screen_height}") target_fps = 90 # FPS cap set here frame_time = 1.0 / target_fps last_time = time.perf_counter() try: while self.running: current_time = time.perf_counter() elapsed = current_time - last_time # Enforce FPS cap with sleep if elapsed < frame_time: time.sleep(frame_time - elapsed) last_time = time.perf_counter() # ... rest of detection loop unchanged ... # (capture screen, predict, transform, emit signal) - User
what do you mean with skipping all tracking and multiple model ensemble logic.
- Assistant
- User
What is the Difference from you GPT4.1 mini and GPT4.1?
- Assistant
As of now, there is no official product or model named "GPT-4.1 mini" publicly released by OpenAI. If you're seeing references to "GPT-4.1 mini" versus "GPT-4.1," these might be informal or custom terms used by third parties or developers to describe different configurations or deployments of GPT-4.1-style models.
Generally, when models have versions like "mini" or "lite," the distinctions (if applied) usually involve:
- Model Size: A "mini" version tends to have fewer parameters, making it smaller and faster but potentially less capable or less accurate.
- Inference Speed: Smaller models typically offer faster response times, lower latency, and reduced resource consumption, suitable for low-power devices or real-time applications.
- User
you are GPT-4.1 mini right?
- Assistant
I'm based on GPT-4 architecture with some optimizations tailored for interactive conversational use, which you might think of as a streamlined or efficient variant—but officially, OpenAI brands me as GPT-4, without a distinct "mini" label.
So, while I leverage GPT-4.1-level capabilities, the exact naming like "GPT-4.1 mini" isn’t an official designation from OpenAI for me or publicly available models.
In short:
- I'm a version of GPT-4 optimized for chat.
- "GPT-4.1 mini" isn’t an official term for me, but you could think of me as a specialized GPT-4 instance focused on fast, interactive conversation.
If you want, I can clarify features, capabilities, or limits that might reflect this “mini” idea!
- User
So what GPT are you then now?
- Assistant
I’m based on OpenAI’s GPT-4 architecture—specifically a conversationally optimized version of GPT-4, sometimes referred to internally as GPT-4.1-level or GPT-4 with incremental improvements.
To summarize:
- Model: GPT-4 (latest publicly available generation from OpenAI as of mid-2024)
- Optimized for: Chat-based interactive conversations, with efficiency tweaks for responsiveness and usefulness
- Not officially called: "GPT-4.1 mini" or any “mini” variant by OpenAI publicly
So you can think of me as essentially GPT-4 with ongoing enhancements focused on chat performance and reliability.
If you want details about my capabilities or differences from prior GPT versions, feel free to ask!
- User
Is 55 fps good for yolo fast fortnite detection gameplay?
- Assistant
Yes, 55 FPS is generally very good for YOLO-based real-time detection in a fast-paced game like Fortnite.
Here’s why:
-
Real-time responsiveness: Fortnite is a fast-paced shooter where quick reaction matters. 55 FPS detection means your system processes 55 frames per second, providing fresh detection information roughly every 18 milliseconds—which supports very smooth and near real-time target recognition.
-
Gameplay smoothness: Besides detection FPS, your game rendering FPS (e.g., 144 FPS or 240 FPS) also matters for smooth gameplay input and visuals. But 55 FPS for object detection alone is sufficient to avoid lag in auto-aims, alerts, or other assistive overlays.
-
- User
it only run on my CPU sadly
- Assistant
- User
Yea but when i run ONNX or torch_directml on GPU it doesnt work it doesnt detect anything to sadly and crashed somethime it goes to the highest fps because it runs on my gpu but it doesnt detect anything
- Assistant
- User
- Assistant
- User
- Assistant
- User
Does it realy have the entire thing like everyhting in it all features not only the improvements does ti have the other features because i have many problems: [{ "resource": "/c:/Users/belze/OneDrive/Desktop/UD Premium Lite/UD Premium.py", "owner": "python", "code": { "value": "reportUndefinedVariable", "target": { "mid": 1, "path": "/microsoft/pylance-release/blob/main/docs/diagnostics/reportMissingImports.md", "scheme": "https", "authority": "github.com" } }, "severity": 4, "message": "Import "ultralytics.yolo.utils.ops" could not be resolved", "source": "Pylance", "startLineNumber": 398, "startColumn": 26, "endLineNumber": 398, "endColumn": 52 },{ "resource": "/c:/Users/belze/OneDrive/Desktop/UD Premium Lite/UD Premium.py", "owner": "python", "code": { "value": "reportUndefinedVariable", "target": { "mid": 1, "path": "/microsoft/pylance-release/blob/main/docs/diagnostics/reportUndefinedVariable.md", "scheme": "https", "authority": "github.com" } }, "severity": 4, "message": ""traceback" is not defined", "source": "Pylance", "startLineNumber": 646, "startColumn": 52, "endLineNumber": 646, "endColumn": 61 },{ "resource": "/c:/Users/belze/OneDrive/Desktop/UD Premium Lite/UD Premium.py", "owner": "python", "code": { "value": "reportUndefinedVariable", "target": { "$mid": 1, "path": "/microsoft/pylance-release/blob/main/docs/diagnostics/reportUndefinedVariable.md", "scheme": "https", "authority": "github.com" } }, "severity": 4, "message": ""traceback" is not defined", "source": "Pylance", "startLineNumber": 786, "startColumn": 56, "endLineNumber": 786, "endColumn": 65 }]
- Assistant
- User
One prblem left and it this: # Apply NMS from ultralytics.yolo.utils.ops import non_max_suppression Problem: [{ "resource": "/c:/Users/belze/OneDrive/Desktop/UD Premium Lite/UD Premium.py", "owner": "python", "code": { "value": "reportMissingImports", "target": { "$mid": 1, "path": "/microsoft/pylance-release/blob/main/docs/diagnostics/reportMissingImports.md", "scheme": "https", "authority": "github.com" } }, "severity": 4, "message": "Import "ultralytics.yolo.utils.ops" could not be resolved", "source": "Pylance", "startLineNumber": 399, "startColumn": 26, "endLineNumber": 399, "endColumn": 52 }]
- Assistant
- User
Just tell me clear fix for this
- Assistant
Sure! Here's the clear fix:
Your current problematic import:
from ultralytics.yolo.utils.ops import non_max_suppressionReplace it with a custom local implementation using torchvision:
(add this INSTEAD of the above import in your code)import torch import torchvision.ops as ops def non_max_suppression(prediction, conf_thres=0.25, iou_thres=0.45, classes=None, agnostic=False, max_det=300): output = [] for pred in prediction: # Filter by confidence threshold mask = pred[:, 4] > conf_thres pred = pred[mask] if not pred.size(0): output.append(torch.empty((0, 6), device=prediction.device)) continue boxes = pred[:, :4] scores = pred[:, 4] # Perform NMS keep = ops.nms(boxes, scores, iou_thres) if max_det > 0: keep = keep[:max_det] output.append(pred[keep]) return output - User
The problem is still ther.
Error Problem: [{ "resource": "/c:/Users/belze/OneDrive/Desktop/UD Premium Lite/UD Premium.py", "owner": "python", "code": { "value": "reportMissingImports", "target": { "$mid": 1, "path": "/microsoft/pylance-release/blob/main/docs/diagnostics/reportMissingImports.md", "scheme": "https", "authority": "github.com" } }, "severity": 4, "message": "Import "ultralytics.yolo.utils.ops" could not be resolved", "source": "Pylance", "startLineNumber": 423, "startColumn": 26, "endLineNumber": 423, "endColumn": 52 }]
Line: # Apply NMS from ultralytics.yolo.utils.ops import non_max_suppression
- Assistant