private PredictionInfo GetPredictionInfo(PredictionController controller) { PredictionInfo info = null; controller.OnPredictionUpdate.Add(p => info = p); controller.UpdatePrediction(); return(info); }
public void LReset() { DataReady = false; PredictionData = new PredictionInfo(); CountTime = false; BackSensor.GetComponent <SensorController>().lookForTrigger = true; FrontSensor.GetComponent <SensorController>().lookForTrigger = false; }
public LibCaffeWrapper(int classInfo) { GoA = classInfo; Prediction = new PredictionInfo(); Prediction.classInfo = -1; Prediction.confidence = -1; AgePreInfo = new PredictionInfo(); AgePreInfo.classInfo = -1; AgePreInfo.confidence = -1; GenderPreInfo = new PredictionInfo(); GenderPreInfo.classInfo = -1; GenderPreInfo.confidence = -1; GoA = classInfo; }
public void ChooseScene() { Solution = new PredictionInfo(); WeaponInfo thisWeapon = _gameContainer.WeaponList.GetRandomItem(); if (thisWeapon.Name == "") { throw new BasicBlankException("Weapon must have name to be part of solution"); } Solution.WeaponName = thisWeapon.Name; var thisCharacter = _gameContainer.CharacterList.GetRandomItem(); Solution.CharacterName = thisCharacter.Name; var thisRoom = _gameContainer.RoomList.GetRandomItem(); Solution.RoomName = thisRoom.Name; }
public void tbxSearch_TextChanged(object sender, EventArgs e) { TextBox eObj = sender as TextBox; tbxS = eObj; // IList<string> autocompleteResult = PredicSearch(tbxSearch.Text); PredictionInfo pred = new PredictionInfo(tbxS.Text); List <SceneInfo> predList = pred.GetList(5); //MessageBox.Show(predList.Count.ToString() + " " + tbxSearch.Text); if (predList.Count > 0) { lbxS.DataSource = predList; lbxS.DisplayMember = "SceneName"; lbxS.Visible = true; lbxS.SelectedIndex = -1; } else { lbxS.Visible = false; } }
private List <Card> CardsFromInfo(PredictionInfo info) { return(info.PredictedCards.Select(i => i.Card).ToList()); }
public PredictionInfo DoPrediction(int paddlePosition) { Color debugColor = Color.black; if (paddlePosition == 0) { debugColor = Color.red; } if (paddlePosition == 1) { debugColor = Color.blue; } int nextGoal = 0; //temp variable just to store the next goal we hit to check against paddle position RaycastHit2D[] predictedHits = new RaycastHit2D[10]; Vector2[] predictedMovementVectors = new Vector2[11]; RaycastHit2D[] allColliders = new RaycastHit2D[10]; //we need to do a RaycastAll for each raycast to remove if we started inside a collider (not iterated, raycast should never pass through more than 5 colliders(?)) PredictionInfo predictionInfo = new PredictionInfo(); for (var i = 0; i < 10; i++) { debugColor[3] = .75f - (i / 10f); //Debug.Log("prediction point " + i); //first prediction if (i == 0) { // bit shift the index of the layer to get a bit mask predictedHits[i] = Physics2D.Raycast(transform.position, movementVector, 500f, 1 << 8); // bit shift the index of the layer to get a bit mask Debug.DrawLine(transform.position, predictedHits[i].point, debugColor, .12f); predictedMovementVectors[i] = movementVector; } //all other predictions else { if (predictedHits[i - 1].collider != null) //if the previous iterations raycast found a collider { if (predictedHits[i - 1].collider.name.Contains("Wall") || predictedHits[i - 1].collider.name.Contains("Prediction")) //reflect previous iterations movement vector to use for this ray { if (predictedHits[i - 1].collider.name.Contains("Vertical")) { predictedMovementVectors[i] = ReflectHorizontal(predictedMovementVectors[i - 1]); } if (predictedHits[i - 1].collider.name.Contains("Horizontal")) { predictedMovementVectors[i] = ReflectVertical(predictedMovementVectors[i - 1]); } } //do raycast allColliders = Physics2D.RaycastAll(predictedHits[i - 1].point, predictedMovementVectors[i], 300f, 1 << 8); // bit shift the index of the layer to get a bit mask if (allColliders.Length > 1) { if (allColliders[0].collider == predictedHits[i - 1].collider) { predictedHits[i] = allColliders[1]; //we started inside the collider we hit previously so we will ignore it Debug.DrawLine(predictedHits[i - 1].point, predictedHits[i].point, debugColor, .3f); //Debug.Log("Prediction Bounce: " + i + " -- Hit collider name: " + predictedHits[i].collider.name); } } } } //after we have our predicted hit for this iteration, check collisions to see if prediction hits the goal if (predictedHits[i].collider != null) { if (predictedHits[i].collider.name.Contains("Prediction")) { Collider2D finalCollider = predictedHits[i].collider; if (finalCollider.name.Contains("1")) { nextGoal = 0; } else if (finalCollider.name.Contains("2")) { nextGoal = 1; } else if (finalCollider.name.Contains("3")) { nextGoal = 2; } else if (finalCollider.name.Contains("4")) { nextGoal = 3; } if (nextGoal == paddlePosition) //this ray collides with a goal that IS our paddles { predictionInfo.finalHitPoint = predictedHits[i].point; predictionInfo.bounces = i; predictionInfo.success = true; return(predictionInfo); } else { if (finalCollider.name.Contains("Prediction")) //reflect previous iterations movement vector to use for this ray { if (finalCollider.name.Contains("Vertical")) { float distance = gameReference.paddles[nextGoal].transform.position.y - predictedHits[i].point.y; if (Mathf.Abs(distance) < 5f) { //Debug.Log("Predicting bounce off enemy paddle #" + nextGoal + " With distance :" + distance); predictedMovementVectors[i].y = predictedMovementVectors[i].y - (distance / 3) * bounceMultiplier; } } if (finalCollider.name.Contains("Horizontal")) { } } } } } } //end of for loop //Debug.Log("Failed to find bounce that didnt hit wall after 10 bounces, giving up on finding final point"); predictionInfo.finalHitPoint = Vector3.zero; predictionInfo.bounces = 0; predictionInfo.success = false; return(predictionInfo); }
public static extern int AgePrediction(string model_file, string trained_file, string mean_file, string image_file, PredictionInfo p);
public static extern int GenderPrediction(string model_file, string trained_file, string mean_file, string image_file, ref PredictionInfo p);
public static extern int GenderPre(string image_file, ref PredictionInfo p);
public void ChooseScene(PredictionInfo thisScene) { Solution = thisScene; }