colored output

master
Peter Babič 9 years ago
parent 33f62685c4
commit 4e3ab442c0
  1. 2
      .gitignore
  2. BIN
      hello.png
  3. 11
      src/neural/BattlefieldParameterEvaluator.java
  4. 9
      src/neural/Palette.java

2
.gitignore vendored

@ -12,4 +12,4 @@
hs_err_pid*
/bin/
*.png
/png/

BIN
hello.png (Stored with Git LFS)

Binary file not shown.

@ -148,6 +148,9 @@ public class BattlefieldParameterEvaluator {
MyTestData[NdxCooling + NdxBattleSize * NUMCOOLINGRATES][1] = 0.1 + 0.9 * ((double) NdxCooling) / NUMCOOLINGRATES;
}
}
Palette palette = new Palette();
// Simulate the neural network with the test samples and fill a matrix
for (int NdxBattleSize = 0; NdxBattleSize < NUMBATTLEFIELDSIZES; NdxBattleSize++) {
for (int NdxCooling = 0; NdxCooling < NUMCOOLINGRATES; NdxCooling++) {
@ -157,17 +160,21 @@ public class BattlefieldParameterEvaluator {
double MyResult = output.getData()[0];
// 2 * fix introduced to shift the top gradient more down to se whole ColorMap spectrum
MyValue = ClipColor(MyResult * 2);
MyColor = new Color((float) MyValue, (float) MyValue, (float) MyValue);
// MyColor = new Color((float) MyValue, (float) MyValue, (float) MyValue);
MyColor = palette.getColor(MyValue);
OutputRGBint[NdxCooling + NdxBattleSize * NUMCOOLINGRATES] = MyColor.getRGB();
}
}
System.out.println("Testing completed.");
// Plot the training samples
for (int NdxSample = 0; NdxSample < NUMSAMPLES; NdxSample++) {
// MyValue = ClipColor(FinalScore1[NdxSample] / BATTLE_MAX_SCORE);
// 2 * fix introduced to shift the top gradient more down to se whole ColorMap spectrum
MyValue = ClipColor(2 * FinalScore1[NdxSample] / BATTLE_MAX_SCORE);
MyColor = new Color((float) MyValue, (float) MyValue, (float) MyValue);
// MyColor = new Color((float) MyValue, (float) MyValue, (float) MyValue);
MyColor = palette.getColor(MyValue);
int MyPixelIndex = (int) (Math.round(NUMCOOLINGRATES * ((GunCoolingRate[NdxSample] / MAXGUNCOOLINGRATE) - 0.1) / 0.9) + Math
.round(NUMBATTLEFIELDSIZES * ((BattlefieldSize[NdxSample] / MAXBATTLEFIELDSIZE) - 0.1) / 0.9)
* NUMCOOLINGRATES);

@ -43,12 +43,15 @@ public class Palette implements Cloneable {
// public static void main(String[] args) {
//
// Palette palette = new Palette();
// palette.split(0.25);
// palette.split(0.5);
// palette.split(0.75);
//// palette.split(0.25);
//// palette.split(0.5);
//// palette.split(0.75);
// System.out.println(palette.getColor(0.990987643));
//
// System.exit(0);
//
// }
//

Loading…
Cancel
Save