mmskeletonwindows安装(mmdetection)及ST-GCN测试和训练

mmskeletonwindows安装(mmdetection)及ST-GCN测试和训练

2023年7月3日发(作者:)

mmskeletonwindows安装(mmdetection)及ST-GCN测试和训练⾸先安装mmdetection:环境:OS: Win10VS: 2015mmdetection: 1.1.0mmcv:0.6.0torch=1.3.1torchvision=0.4.2python:3.7.9cuda:10.1查看cuda版本:nvcc -V⼀、Pytorch环境安装创建虚拟环境:conda create -n mmd python=3.7conda activate mmdconda install pytorch=1.3 torchvision cudatoolkit=10.1 -c pytorchpip install cython opencv-python pillow matplotlib⼆、torch源码修改环境⽬录是指刚刚创建的mm2虚拟环境位置。修改 环境⽬录下Libsite-packagestorchincludec10utilflat_hash_map.h1> 删掉

#include 2> 1379-1398⾏左右,注释或删掉:// std::pair emplace()// {// return emplace(key_type(), convertible_to_value());// }// template// std::pair insert_or_assign(const key_type & key, M && m)// {// auto emplace_result = emplace(key, std::forward(m));// if (!emplace_)// emplace_->second = std::forward(m);// return emplace_result;// }// template// std::pair insert_or_assign(key_type && key, M && m)// {// auto emplace_result = emplace(std::move(key), std::forward(m));// if (!emplace_)// emplace_->second = std::forward(m);// return emplace_result;// }

1473-1493⾏左右,注释或删掉// Args>// std::pair emplace(Args &&... args)// {// return Table::emplace(T(std::forward(args)...));// }// std::pair emplace(const key_type & arg)// {// return Table::emplace(arg);// }// std::pair emplace(key_type & arg)// {// return Table::emplace(arg);// }// std::pair emplace(const key_type && arg)// {// return Table::emplace(std::move(arg));// }// std::pair emplace(key_type && arg)// {// return Table::emplace(std::move(arg));// }2.修改 环境⽬录下Libsite-packagestorchincludec10utilorder_preserving_flat_hash_map.h注释或删除1499-1518⾏// std::pair emplace()// {// return emplace(key_type(), convertible_to_value());// }// template// std::pair insert_or_assign(const key_type & key, M && m)// {// auto emplace_result = emplace(key, std::forward(m));// if (!emplace_)// emplace_->second = std::forward(m);// return emplace_result;// }// template// std::pair insert_or_assign(key_type && key, M && m)// {// auto emplace_result = emplace(std::move(key), std::forward(m));// if (!emplace_)// emplace_->second = std::forward(m);// return emplace_result;// }注释或删除1593-1613⾏// Args>// std::pair emplace(Args &&... args)// {// return Table::emplace(T(std::forward(args)...));// }// std::pair emplace(const key_type & arg)// {// return Table::emplace(arg);// }// std::pair emplace(key_type & arg)// {// return Table::emplace(arg);// }// std::pair emplace(const key_type && arg)// {// return Table::emplace(std::move(arg));// }// std::pair emplace(key_type && arg)// {// return Table::emplace(std::move(arg));// }3.修改 环境⽬录下Libsite-packagestorchutilscpp_185⾏修改成:match = (r'(d+).(d+).(d+)', compiler_("utf8","ignore").strip())4.修改 环境⽬录下Libsite-packagestorchincludetorchcsrcjitargument_spec.h190⾏左右修改:将

static conststr size_t DEPTH_LIMIT = 128;替换成

static const size_t DEPTH_LIMIT = 128;5.修改 环境⽬录下Libsite-packagestorchincludepybind11cast.h1448⾏左右将

explicit operator type&() { return *(this->value); }python build_ext --inplacepython build_ext install三、mmdeteciton安装安装利⽤pip install mmcv==1.1.5安装完成后,⼿动去环境⽬录下Libsite-packagesmmcvutils找到⽂件在100⾏左右新加:temp_config_()修改后如下所⽰:with aryDirectory() as temp_config_dir: temp_config_file = emporaryFile( dir=temp_config_dir, suffix='.py') #

新加的 temp_config_() temp_config_name = me(temp_config_) le(filename, (temp_config_dir, temp_config_name)) temp_module_name = xt(temp_config_name)[0] (0, temp_config_dir) Config._validate_py_syntax(filename) mod = import_module(temp_module_name)pip install -r 修改⽂件中CUDAExtension中extra_compile_args相关代码,增加cxx的"-DMS_WIN64","-MD"python developpip install -r hon develop (或者 python install)四、安装mmskeleton:python developwith open('', encoding='utf-8') as infile: readme = ()保存。 打开prompt 进⼊解压路径执⾏“python install”进⾏安装即可。问题⼆: No module named '_nms’解决⽅法:暴⼒解决(主要其他⽅法⾏不通)修改下的⽂件注释13,14⾏,增加cpu_nms函数:def cpu_nms(dets, thresh):

x1 = dets[:,0] y1 = dets[:,1] x2 = dets[:,2] y2 = dets[:,3] areas = (y2-y1+1) * (x2-x1+1) scores = dets[:,4] keep = [] index = t()[::-1] while >0: i = index[0] # every time the first is the biggst, and add it directly (i)

x11 = m(x1[i], x1[index[1:]]) # calculate the points of overlap

y11 = m(y1[i], y1[index[1:]]) x22 = m(x2[i], x2[index[1:]]) y22 = m(y2[i], y2[index[1:]])

w = m(0, x22-x11+1) # the weights of overlap h = m(0, y22-y11+1) # the height of overlap

overlaps = w*h ious = overlaps / (areas[i]+areas[index[1:]] - overlaps)

idx = (ious<=thresh)[0] index = index[idx+1] # because index start from 1

return keep修改后的⽂件内容如下:安装完成后的配置:五、mmskeleton测试:python pose_demo六、ST-GCN模型测试及问题:st-gcn测试数据准备:python deprecated/tools/data_processing/kinetics_ --data_path st-gcn模型测试:python configs/recognition/st_gcn_aaai18/kinetics-skeleton/问题⼀:D::64: UserWarning: The old API ofregister_module(module, force=False) is deprecated and will be removed, please use the new APIregister_module(name=None, force=False, module=None) instead.解决⽅法:安装⾼版本的mmcv,如mmcv==1.1.5问题⼆:TypeError: __init__() got an unexpected keyword argument 'num_stages'问题原因:mmdet版本不正确,安装mmdet 1.0rcl或其他版本问题三:(mmd) E:mmskeleton-master>python configs/recognition/st_gcn_aaai18/kinetics-skeleton/:Anaconda3envsmmdlibsite-packagesCythonDistutilsold_build_:41: UserWarning: _build_ext does not properly handle dependencies and is deprecated. "_build_ext does not properly handle dependencies "Load configuration information from configs/recognition/st_gcn_aaai18/kinetics-skeleton/{'type': '', 'checkpoint': 'mmskeleton://st_gcn/kinetics-skeleton', 'model_cfg': {'type': '_GCN_18', 'in_channels': 3, 'num_class': 400, 'edge_importance_weighting': True, 'graph_cfg': {'layout': 'openpose', 'strategy': 'spatial'}}, 'dataset_cfg': {'type': 'on_onFeeder', 'data_path': './data/Kinetics/kinetics-skeleton/val_', 'label_path': './data/Kinetics/kinetics-skeleton/val_'}, 'batch_size': 4, 'gpu_batch_size': 4, 'gpus': -1}[ ] 0/19796, elapsed: 0s, ETA:D:Anaconda3envsmmdlibsite-packagesCythonDistutilsold_build_:41: UserWarning: _build_ext does not properly handle dependencies and is deprecated. "_build_ext does not properly handle dependencies "D:Anaconda3envsmmdlibsite-packagesCythonDistutilsold_build_:41: UserWarning: _build_ext does not properly handle dependencies and is deprecated. "_build_ext does not properly handle dependencies "Traceback (most recent call last): File "", line 127, in main() File "", line 121, in main call_obj(**sor_cfg) File "E:", line 24, in call_obj return import_obj(type)(**kwargs) File "E:", line 45, in test for data, label in data_loader: File "D:", line 278, in __iter__ return _MultiProcessingDataLoaderIter(self) File "D:", line 682, in __init__ () File "D:", line 112, in start self._popen = self._Popen(self) File "D:", line 223, in _Popen return _default__context().Process._Popen(process_obj) File "D:", line 322, in _Popen return Popen(process_obj) File "D:Anaconda3envsmmdlibmultiprocessingpopen_spawn_", line 89, in __init__ (process_obj, to_child) File "D:", line 60, in dump ForkingPickler(file, protocol).dump(obj)OSError: [Errno 22] Invalid argumentTraceback (most recent call last): File "", line 1, in File "D:", line 105, in spawn_main exitcode = _main(fd) File "D:", line 115, in _main self = (from_parent)_lingError: pickle data was truncated解决⽅法:修改/mmskeleton/processor/⽂件中的test函数,将workers改为0。def test(model_cfg, dataset_cfg, checkpoint, batch_size=None, gpu_batch_size=None, gpus=-1, workers=0):七、ST-GCN模型训练:python configs/recognition/st_gcn_aaai18/kinetics-skeleton/my_问题⼀:INFO::workflow: [('train', 5), ('val', 1)], max: 50 epochsTraceback (most recent call last): File "", line 142, in main() File "", line 122, in main call_obj(**sor_cfg) File "E:", line 25, in call_obj return import_obj(type)(**kwargs) File "E:", line 120, in train (data_loaders, workflow, total_epochs, loss=loss) File "D:", line 359, in run epoch_runner(data_loaders[i], **kwargs) File "D:", line 259, in train for i, data_batch in enumerate(data_loader): File "D:", line 278, in __iter__ return _MultiProcessingDataLoaderIter(self) File "D:", line 682, in __init__ () File "D:", line 112, in start self._popen = self._Popen(self) File "D:", line 223, in _Popen return _default__context().Process._Popen(process_obj) File "D:", line 322, in _Popen return Popen(process_obj) File "D:Anaconda3envsmmdlibmultiprocessingpopen_spawn_", line 89, in __init__ (process_obj, to_child) File "D:", line 60, in dump ForkingPickler(file, protocol).dump(obj)OSError: [Errno 22] Invalid argumentTraceback (most recent call last): File "", line 1, in File "D:", line 105, in spawn_main exitcode = _main(fd) File "D:", line 115, in _main self = (from_parent)_lingError: pickle data was truncated解决⽅法:修改/mmskeleton/processor/⽂件中的train函数,将workers改为0问题⼆:OSError: symbolic link privilege not held解决⽅法:以管理员⽅式打开prompt(windows菜单栏右键搜索,搜索cmd,右键选择以管理员⽅式运⾏)问题三:TypeError: logger must be a object, but got 解决⽅法:pip install mmcv==0.4.0问题四:Cannot find installation of real FFmpeg (which comes with ffprobe)解决⽅法:conda install ffmpeg -c conda-forge问题五:loss不下降解决办法:增加红⾊框⾥⾯缺少的内容

发布者:admin,转转请注明出处:http://www.yc00.com/xiaochengxu/1688383240a129789.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信