Skip to content

Commit

Permalink
fix_reading_nan_in_evolve (ultralytics#10358)
Browse files Browse the repository at this point in the history
when there is `nan` in evolve.csv pandas read it as str 
remove the space before fix that 

Signed-off-by: Michael Ben ami <31584614+mbenami@users.noreply.github.com>

Signed-off-by: Michael Ben ami <31584614+mbenami@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
  • Loading branch information
mbenami and glenn-jocher authored Dec 1, 2022
1 parent b412696 commit 028b7cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ def print_mutation(keys, results, hyp, save_dir, bucket, prefix=colorstr('evolve

# Save yaml
with open(evolve_yaml, 'w') as f:
data = pd.read_csv(evolve_csv)
data = pd.read_csv(evolve_csv, skipinitialspace=True)
data = data.rename(columns=lambda x: x.strip()) # strip keys
i = np.argmax(fitness(data.values[:, :4])) #
generations = len(data)
Expand Down

0 comments on commit 028b7cd

Please sign in to comment.