feat(rl): improve training performance, logging, and run comparability - #193
Open
FelixReite wants to merge 36 commits into
Open
feat(rl): improve training performance, logging, and run comparability#193FelixReite wants to merge 36 commits into
FelixReite wants to merge 36 commits into
Conversation
…bot controller to APPRemoteControl only for rl_supervisor.
Introduced ready for training flag for increased initial training data size Optimized GAE calculation to be O(n) Placing Robot at random locations on the track Updated hyperparameters for more robust training from scratch (Lowered Regularization, Increased starting experimentation std_dev) Changed storage of weight only (h5 format), for compatibility
Reshape advantages from (batch,) to (batch, 1) to prevent unintended broadcasting in the actor and critic loss calculations. Also convert generated training arrays to float32.
Pass the agent's current standard deviation directly to the actor gradient calculation. This keeps action sampling and probability recalculation consistent and prevents incorrect PPO probability ratios.
Record the total reward only once per episode instead of once per mini-batch. Average the actor and critic losses across all training steps of an episode.
Calculate generalized advantage estimates in a single backward pass, reducing the runtime from O(n²) to O(n).
Normalize advantages for actor updates while keeping raw advantages for critic training. Prevent the agent from collecting rewards on the ignored start line.
Initialize the actor output layer with zero weights so a fresh policy starts with a neutral steering mean instead of a random turn.
End episodes after eight consecutive no-line samples and avoid repeated penalties during line-loss detection.
Cycle through straight and curved start poses in both directions.
Enable Webots performance options, remove an unused tensor conversion, and update the trained actor and critic model weights.
Initialize the training log once per agent run and append only the latest episode result during training to avoid rewriting the full history each time.
Remove the fixed optimalThreadCount setting because running the simulation with multiple threads caused unreliable logging behavior.
Store training metrics and run configuration in timestamped run directories. Update plotting scripts to select a run explicitly via --run.
Separate training update and episode counters in RL logs. Add mean episode steps to training metrics for better run comparison. Aggregate action diagnostics per episode before plotting scores by training update.
Add compare_runs.py to compare multiple logged training runs, including metric plots and a run configuration diff for changed parameters.
Add parallel_runs.py to start isolated Webots RL runs with separate ports, logs, models, process logs, and PlatformIO build directories. Allow run configs to define per-run hyperparameters and pass them through the supervisor into the agent. Extend comparison support for training_runs experiments and document the parallel run workflow.
Filter all-zero line sensor frames after episode resets until the first non-zero sensor sample starts the next episode. This keeps reset-time sensor artifacts out of the training data and diagnostics.
Replace the training reward log value with the mean reward of completed episodes in each training update. This makes reward comparisons less dependent on the number of collected transitions.
Avoids warnings from name-mangled attributes.
Update license headers and add the standard section structure to previously unstructured RL supervisor scripts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.