0. Problem description: COCO dataset training to half suddenly interrupted, look at the C disk shows red, there is not much memory (training, generated in AppData/Temp in the temporary file too much)
As shown in the figure: as the epoch increases, the file is getting bigger and bigger (the figure is still yolox-tiny), if we use yolox-x, the C drive is directly full!
1. Problem Cause.
YOLOX-main/yolox/evaluators/coco_evaluator.py in line 203 or so **tempfile.mkstemp()** after creating the file, no close() and remove() operations are performed
The following figure.

2. Solution methods
(1) Method 1
As shown above, add os.close(_) and os.remove(tmp) two lines of code, directly delete the file just created after use. Note: import os module at the beginning]
(2) Method 2
The problem is already known, you can use with…as… to create, automatically delete and close the file.
(3) Method 3
If you want to keep each temporary file, and do not want to C drive blow up, then directly change the save location to a custom path.
Code location: Anoconda/envs/using-environment/Lib/tempfile.py in line 159-185.
directly change the direct dirlist operation to the user-defined folder location, as follows:
(4) Method 4
Manually clean up files in temp at regular intervals
Note: VOC format dataset training, no temporary files are generated because it uses the with…as… file creation method. For details, please refer to the end of voc_evaluater.py
Read More:
- How to Solve word2vec Module Error: AttributeError & UnicodeDecodeError
- [Solved] RuntimeError: unexpected EOF, expected 73963 more bytes. The file might be corrupted.
- urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
- ModuleNotFoundError: No module named ‘tensorflow.python’ And the pits encountered after installation
- Linux Fatal Python error: Py_Initialize Unable to get the locale encoding
- [Solved] Model training Error: _pickle.PicklingError: Can’t pickle
- [Solved] Pycham Error: non zero exit code (2)
- [Solved] Odoo Cannot log in error after the Database is Recovered
- Raspberry pie Use PCA9685() Error: [Errno 121] Remote I/O error
- [Solved] RuntimeError: cuda runtime error: device-side assert trigger
- Python openpyxl excel open zipfile error resolution: zipfile.BadZipFile: File is not a zip file
- [Solved] From pip._internal import cmdoptions ImportError: cannot import name SourceDistribution
- Pytorch ValueError: Expected more than 1 value per channel when training, got input size [1, 768
- Python Redis: How to batch fuzzy Delete Keys
- SyntaxError: Non-ASCII character ‘\xe5‘ in file [How to Solve]
- [Solved] The appium doctor error: bundletool.jar under win10
- [Solved] Python Error: An attempt has been made to start a new process before the current process has finished …
- Pytorch Loading model error: RuntimeError: Error(s) in loading state_dict for Model: Missing key(s) in state_dict
- [Solved] RuntimeError: function ALSQPlusBackward returned a gradient different than None at position 3, but t
- Python ProgressBar adds its own dynamic information to the progress bar