Description of the problem
When running mAP/main.py in Google Colab, the following error appears:
AttributeError: 'FigureCanvasAgg' object has no attribute 'set_window_title'
This happens because Colab uses FigureCanvasAgg, which does not implement the method set_window_title().
Affected file
mAP/main.py
Approximate line: 704
Current code:
fig.canvas.set_window_title('AP ' + class_name)
Proposed solution
Replace that line with a Colab-compatible alternative:
# Try to set window title (works on desktop environments)
try:
fig.canvas.set_window_title('AP ' + class_name)
except Exception:
# Fallback for Colab / Jupyter / FigureCanvasAgg
fig.canvas.manager.set_window_title('AP ' + class_name)
This ensures that:
- The script still works in environments with a window manager.
- Google Colab does not throw an error.
- The figure retains a proper title.
Additional notes
This bug occurs at the end of the mAP evaluation process, right when the AP curves for each class are generated.
Description of the problem
When running
mAP/main.pyin Google Colab, the following error appears:AttributeError: 'FigureCanvasAgg' object has no attribute 'set_window_title'
This happens because Colab uses
FigureCanvasAgg, which does not implement the methodset_window_title().Affected file
mAP/main.pyApproximate line: 704
Current code:
Proposed solution
Replace that line with a Colab-compatible alternative:
This ensures that:
Additional notes
This bug occurs at the end of the mAP evaluation process, right when the AP curves for each class are generated.