private void Awake() { ships = new List <Ship>(); targetFleets = new List <Fleet>(); detector = GetComponentInChildren <DetectionSystem>(); center = transform.position; }
private void CheckSetting() { while (true) { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate { if (tb_cfg.Text != "" && tb_names.Text != "" && tb_weights.Text != "") { bd_Setting.Visibility = Visibility.Collapsed; bd_Testing.Visibility = Visibility.Visible; Wrapper = new YoloWrapper(tb_cfg.Text, tb_weights.Text, tb_names.Text, 0, false); DetectionSystem = Wrapper.DetectionSystem; switch (DetectionSystem) { case DetectionSystem.CPU: tb_state.Text = "CPU 환경 : "; break; case DetectionSystem.GPU: tb_state.Text = "GPU 환경 : "; break; default: break; } t1.Abort(); } })); } }
private void Initialize(string configurationFilename, string weightsFilename, string namesFilename, GpuConfig gpuConfig) { if (IntPtr.Size != 8) { throw new NotSupportedException("Only 64-bit processes are supported"); } var systemReport = this._yoloSystemValidator.Validate(); if (!systemReport.MicrosoftVisualCPlusPlusRedistributableExists) { throw new YoloInitializeException("Microsoft Visual C++ 2017-2019 Redistributable (x64)"); } this.DetectionSystem = DetectionSystem.CPU; if (gpuConfig != null) { if (!systemReport.CudaExists) { throw new YoloInitializeException("Cuda files not found"); } if (!systemReport.CudnnExists) { throw new YoloInitializeException("Cudnn not found"); } var deviceCount = GetDeviceCount(); if (deviceCount == 0) { throw new YoloInitializeException("No Nvidia graphic device is available"); } if (gpuConfig.GpuIndex > (deviceCount - 1)) { throw new YoloInitializeException("Graphic device index is out of range"); } this.DetectionSystem = DetectionSystem.GPU; } switch (this.DetectionSystem) { case DetectionSystem.CPU: InitializeYoloCpu(configurationFilename, weightsFilename, 0); break; case DetectionSystem.GPU: InitializeYoloGpu(configurationFilename, weightsFilename, gpuConfig.GpuIndex); break; } this._objectTypeResolver = new YoloObjectTypeResolver(namesFilename); }
private void OnEnable() { movement = GetComponent <AgentMovement>(); input = GetComponent <PlayerInput>(); agentAnimations = GetComponent <HumanoidAnimations>(); currentState = movementState; currentState.EnterState(this); AssignInputListeners(); detectionSystem = GetComponent <DetectionSystem>(); gameManager = FindObjectOfType <GameManager>(); }
protected override void InitializeEnemy() { base.InitializeEnemy(); player1 = GameObject.Find("Player"); player2 = GameObject.Find("Player2"); chasehandler = new ChaseHandler(animator, myRigidBody, transform, speed, pathfinder); wanderHandler = new WanderHandler(aiPath); detectionSystem = new DetectionSystem(transform, player1.transform, player2.transform, detectionRange, pathfinder); player1Variables = player1.GetComponent <Player>(); player2Variables = player2.GetComponent <Player>(); }
private void Initialize(string configurationFilename, string weightsFilename, string namesFilename, int gpu = 0) { if (IntPtr.Size != 8) { throw new NotSupportedException("Only 64-bit process are supported"); } this.EnvironmentReport = this.GetEnvironmentReport(); if (!this.EnvironmentReport.MicrosoftVisualCPlusPlus2017RedistributableExists) { throw new DllNotFoundException("Microsoft Visual C++ 2017 Redistributable (x64)"); } this.DetectionSystem = DetectionSystem.CPU; if (this.EnvironmentReport.CudaExists && this.EnvironmentReport.CudnnExists) { this.DetectionSystem = DetectionSystem.GPU; } switch (this.DetectionSystem) { case DetectionSystem.CPU: InitializeYoloCpu(configurationFilename, weightsFilename, 0); break; case DetectionSystem.GPU: var deviceCount = GetDeviceCount(); if (gpu > (deviceCount - 1)) { throw new IndexOutOfRangeException("Graphic device index is out of range"); } var deviceName = new StringBuilder(); //allocate memory for string GetDeviceName(gpu, deviceName); this.EnvironmentReport.GraphicDeviceName = deviceName.ToString(); InitializeYoloGpu(configurationFilename, weightsFilename, gpu); break; } var lines = File.ReadAllLines(namesFilename); for (var i = 0; i < lines.Length; i++) { this._objectType.Add(i, lines[i]); } }
void Awake() { systems = GetComponentsInChildren <ShipSystem> (); autoWeaponSystem = GetComponentInChildren <AutoWeaponSystem> (); flightSystem = GetComponentInChildren <FlightSystem> (); detectionSystem = GetComponentInChildren <DetectionSystem> (); cargoSystem = GetComponentInChildren <CargoSystem> (); tradeSystem = GetComponentInChildren <TradeSystem> (); if (flightSystem != null) { flightSystem.MyBody = GetComponent <Rigidbody> (); // Ужас! } if (detectionSystem != null && autoWeaponSystem != null) { autoWeaponSystem.SubscribeToDetectionSystem(detectionSystem); } if (tradeSystem != null && cargoSystem != null) { tradeSystem.SubscribeToCargoSystem(cargoSystem); } }
private void Initialize(string configurationFilename, string weightsFilename, string namesFilename, DetectionSystem detectionSystem, int gpu = 0) { if (IntPtr.Size != 8) { throw new NotSupportedException("Only 64-bit process are supported"); } DetectionSystem = detectionSystem; switch (this.DetectionSystem) { case DetectionSystem.CPU: InitializeYoloCpu(configurationFilename, weightsFilename, 0); break; case DetectionSystem.GPU: var deviceCount = GetDeviceCount(); if (gpu > (deviceCount - 1)) { throw new IndexOutOfRangeException("Graphic device index is out of range"); } var deviceName = new StringBuilder(); //allocate memory for string GetDeviceName(gpu, deviceName); var deviceNameData = deviceName.ToString(); Console.WriteLine($"Using: {deviceNameData}"); InitializeYoloGpu(configurationFilename, weightsFilename, gpu); break; } var lines = File.ReadAllLines(namesFilename); for (var i = 0; i < lines.Length; i++) { this._objectType.Add(i, lines[i]); } }
public void UnsubscribeFromDetectionSystem(DetectionSystem detectionSystem) { detectionSystem.OnTargetStatusChanged -= DetectionSystem_OnTargetStatusChanged; }
public void SubscribeToDetectionSystem(DetectionSystem detectionSystem) { detectionSystem.OnTargetStatusChanged += DetectionSystem_OnTargetStatusChanged; }
public YoloWrapper(string configurationFilename, string weightsFilename, string namesFilename, DetectionSystem detectionSystem, int gpu = 0) { this.Initialize(configurationFilename, weightsFilename, namesFilename, detectionSystem, gpu); }
public YoloWrapper(YoloConfiguration yoloConfiguration, DetectionSystem detectionSystem) { this.Initialize(yoloConfiguration.ConfigFile, yoloConfiguration.WeightsFile, yoloConfiguration.NamesFile, 0); }