<p>我从3.8版更改了python版本。根据3.6,使用conda forge安装和重新安装matplotlib</p>
<p>我在MSVSCode中以调试模式运行代码eval_DAVIS.py,而不是从命令行注释参数,如下所示:-</p>
<pre><code># def get_arguments():
# parser = argparse.ArgumentParser(description="SST")
# parser.add_argument("-g", type=str, help="0; 0,1; 0,3; etc", required=True)
# parser.add_argument("-s", type=str, help="set", required=True)
# parser.add_argument("-y", type=int, help="year", required=True)
# parser.add_argument("-viz", help="Save visualization", action="store_true")
# parser.add_argument("-D", type=str, help="path to data",default='/local/DATA')
# return parser.parse_args()
# args = get_arguments()
# GPU = args.g
# YEAR = args.y
# SET = args.s
# VIZ = args.viz
# DATA_ROOT = args.D
GPU = '0'
YEAR = '17'
SET = 'val'
VIZ = 'store_true'
DATA_ROOT = '..\\DAVIS2017SemiSupervisedTrainVal480'
</code></pre>
<p>越界</p>
<pre><code>for seq, V in enumerate(Testloader):
</code></pre>
<p>我写这篇文章是为了测试是否存在cuda可用的问题</p>
<pre><code>if torch.cuda.is_available() == False:
print("********** CUDA is NOT available just before line of error **********")
else:
print("********** CUDA is available, and working fine just before line of error ***********")
</code></pre>
<p>这将生成以下终端日志</p>
<pre><code>Space-time Memory Networks: initialized.
STM : Testing on DAVIS
using Cuda devices, num: 1
--- Produce mask overaid video outputs. Evaluation will run slow.
--- Require FFMPEG for encoding, Check folder ./viz
Loading weights: STM_weights.pth
Start Testing: STM_DAVIS_17val
********** CUDA is available, and working fine just before line of error ***********
Space-time Memory Networks: initialized.
STM : Testing on DAVIS
using Cuda devices, num: 1
--- Produce mask overaid video outputs. Evaluation will run slow.
--- Require FFMPEG for encoding, Check folder ./viz
Space-time Memory Networks: initialized.
STM : Testing on DAVIS
using Cuda devices, num: 1
--- Produce mask overaid video outputs. Evaluation will run slow.
--- Require FFMPEG for encoding, Check folder ./viz
Loading weights: STM_weights.pth
Loading weights: STM_weights.pth
Start Testing: STM_DAVIS_17val
********** CUDA is available, and working fine just before line of error ***********
Start Testing: STM_DAVIS_17val
********** CUDA is available, and working fine just before line of error ***********
</code></pre>
<p>它到达这行代码</p>
<pre><code>for seq, V in enumerate(Testloader):
</code></pre>
<p>并提供以下错误消息:-</p>
<pre><code>Exception has occurred: RuntimeError
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
File "C:\Users\OneWorld\Documents\DeepLearning\VideoObjectSegmentation\STMVOS\eval_DAVIS.py", line 127, in <module>
for seq, V in enumerate(Testloader):
File "<string>", line 1, in <module>
</code></pre>
<p>因此,这消除了CUDA错误,无需切换代码以使用CPU</p>
<p>但是,这仍然会产生冻结支持()错误</p>
<p>日志会识别数据加载程序错误:-</p>
<pre><code>Traceback (most recent call last):
File "eval_DAVIS.py", line 127, in <module>
for seq, V in enumerate(Testloader):
File "C:\Users\OneWorld\anaconda3\envs\STMVOS\lib\site-packages\torch\utils\data\dataloader.py", line 345, in __next__
data = self._next_data()
File "C:\Users\OneWorld\anaconda3\envs\STMVOS\lib\site-packages\torch\utils\data\dataloader.py", line 841, in _next_data
idx, data = self._get_data()
File "C:\Users\OneWorld\anaconda3\envs\STMVOS\lib\site-packages\torch\utils\data\dataloader.py", line 798, in _get_data
success, data = self._try_get_data()
File "C:\Users\OneWorld\anaconda3\envs\STMVOS\lib\site-packages\torch\utils\data\dataloader.py", line 774, in _try_get_data
raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.format(pids_str))
RuntimeError: DataLoader worker (pid(s) 15916, 1232) exited unexpectedly
</code></pre>