Skip to content

Commit

Permalink
pokemon logging demo for leanke
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuarez5341 committed Jan 11, 2024
1 parent c741bfe commit 090647e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions clean_pufferl.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,12 @@ def evaluate(data):
continue
if 'pokemon_exploration_map' in k:
import cv2
from pokemon_red_eval import make_pokemon_red_overlay
bg = cv2.imread('kanto_map_dsv.png')
overlay = make_pokemon_red_overlay(bg, sum(v))
if data.wandb is not None:
data.stats['Media/exploration_map'] = data.wandb.Image(overlay)
# @Leanke: Add your infos['learner']['x'] etc
try: # TODO: Better checks on log data types
data.stats[k] = np.mean(v)
except:
Expand Down
2 changes: 1 addition & 1 deletion demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def train(args, env_module, make_env):
agent_creator=make_policy,
agent_kwargs={'env_module': env_module, 'args': args},
model_path=args.eval_model_path,
device=args.args.device
device=args.train.device
)
elif args.mode == 'evaluate' and pkg == 'pokemon_red':
import pokemon_red_eval
Expand Down
2 changes: 1 addition & 1 deletion pokemon_red_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def make_pokemon_red_overlay(bg, counts):

# Convert counts to hue map
hsv = np.zeros((*counts.shape, 3))
hsv[..., 0] = scaled*(240.0/360.0)
hsv[..., 0] = 2*(1-scaled)/3
hsv[..., 1] = nonzero
hsv[..., 2] = nonzero

Expand Down

0 comments on commit 090647e

Please sign in to comment.