1. 程式人生 > >mergin_bn.py error ,AttributeError: 'module' object has no attribute 'text_format' AttributeError: 'module' object has no attr

mergin_bn.py error ,AttributeError: 'module' object has no attribute 'text_format' AttributeError: 'module' object has no attr

AttributeError: 'module' object has no attribute 'text_format'

2017年05月19日 13:12:01 閱讀數:8849
													<span class="tags-box artic-tag-box">
							<span class="label">標籤:</span>
															<a data-track-click="{&quot;mod&quot;:&quot;popu_626&quot;,&quot;con&quot;:&quot;faster rcnn&quot;}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=faster rcnn&amp;t=blog" target="_blank">faster rcnn																</a><a data-track-click="{&quot;mod&quot;:&quot;popu_626&quot;,&quot;con&quot;:&quot;python&quot;}" class="tag-link" href="http://so.csdn.net/so/search/s.do?q=python&amp;t=blog" target="_blank">python																</a>
						<span class="article_info_click">更多</span></span>
																				<div class="tags-box space">
							<span class="label">個人分類:</span>
															<a class="tag-link" href="https://blog.csdn.net/qq_33202928/article/category/6927325" target="_blank">Faster RCNN																</a>
						</div>
																							</div>
			<div class="operating">
													</div>
		</div>
	</div>
</div>
<article class="baidu_pl">
	<div id="article_content" class="article_content clearfix csdn-tracking-statistics" data-pid="blog" data-mod="popu_307" data-dsm="post">
							<div class="article-copyright">
				版權宣告:本文為博主原創文章,未經博主允許不得轉載。					https://blog.csdn.net/qq_33202928/article/details/72526710				</div>
							            <link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-d7e2a68c7c.css">
					<div class="htmledit_views" id="content_views">

最近在學習 faster rcnn ,本來環境已經配置好,已經跑完自己的程式,執行良好,後來安裝了tensorflow,然後重新使用 faster rcnn 進行訓練的時候居然出錯了,我很納悶,期間沒有解除安裝或者修改配置檔案啊,怎麼會這樣?

問題:

pb2.text_format.Merge(f.read(), self.solver_param) AttributeError: 'module' object has no attribute 'text_format'

經過google之後發現是protobuf的本版發生了變換,之前在配置caffe的時候手動安裝了protbuf,版本是2.5.0,後來安裝了tensorflow 我回憶了一下,protobuf的版本貌似是發生了變換。


所以解決辦法:sudo pip install protobuf==2.5.0


剛才又發現一個新的解決方法:

在檔案./lib/fast_rcnn/train.py增加一行import google.protobuf.text_format 即可解決問題