为什么我在tensorflow上的转移学习实现在几次迭代后给我一个错误?(Why is my transfer learning implementation on tensorflow is throwing me an error after a few iterations?)
我正在使用初始v1架构进行传输学习。 我从下面的github存储库下载了checkpoints文件,网络,预处理文件
https://github.com/tensorflow/models/tree/master/slim
我有3700个图像,并从图表中为我的每个图像汇总最后一个池图层过滤器并将其附加到列表中。 随着每次迭代,ram的使用量都会增加,并最终导致大约2000个图像的运行。 你能告诉我我做了什么错吗?
即使我删除附加列表并只是尝试打印结果。 这仍然在发生。 我猜错误在于调用图表的方式。 当我看到我的ram用法时,每次迭代它都变得沉重,我不知道为什么会发生这种情况,因为我没有保存任何东西,也没有第一次迭代之间的区别
从我的观点来看,我只是发送一个图像并获取输出并保存它们。 所以它应该工作,无论我发送多少图像。
我已经在GPU(6GB)和CPU(32GB)上尝试过它。
I am using inception v1 architecture for transfer learning. I have downloded the checkpoints file, nets, pre-processing file from the below github repository
https://github.com/tensorflow/models/tree/master/slim
I have 3700 images and pooling out the last pooling layer filters from the graph for each of my image and appending it to a list . With every iteration the ram usage is increasing and finally killing the run at around 2000 images. Can you tell me what mistake I have done ?
Even if I remove the list appending and just trying to print the results. this is still happening. I guess the mistake is with the way of calling the graph. When I see my ram usage , with every iteration it is becoming heavy and I don't know why this is happening as I am not saving anything nor there is a difference between 1st iteration
From my point, I am just sending one Image and getting the outputs and saving them. So it should work irrespective of how many images I send.
I have tried it on both GPU (6GB) and CPU (32GB).
原文:
最满意答案
我们可以使用
gsub
改变空格字符(\\s+
),然后我们可以用gsubfn
替换'd','h','m','s'并循环输出并计算字符串。library(gsubfn) v2 <- gsubfn("[a-z]", list(d="*24*60*60", h = "*60*60", m = "*60", s="*1"), gsub("\\s+", "+", v1)) unname(sapply(v2, function(x) eval(parse(text=x)))) #[1] 86890197 58197 22197 597 57
数据
v1 <- c(x, x1, x2, x3, x4)
We can change the space character (
\\s+
) with+
usinggsub
, then we can replace 'd', 'h', 'm', 's' withgsubfn
and loop through the output and evaluate the string.library(gsubfn) v2 <- gsubfn("[a-z]", list(d="*24*60*60", h = "*60*60", m = "*60", s="*1"), gsub("\\s+", "+", v1)) unname(sapply(v2, function(x) eval(parse(text=x)))) #[1] 86890197 58197 22197 597 57
data
v1 <- c(x, x1, x2, x3, x4)
相关问答
更多-
def hms_to_seconds(t): h, m, s = [int(i) for i in t.split(':')] return 3600*h + 60*m + s def hms_to_seconds(t): h, m, s = [int(i) for i in t.split(':')] return 3600*h + 60*m + s
-
通过使用divmod()函数,只有一个除法才能产生商和余数,只需两个数学运算即可快速得到结果: m, s = divmod(seconds, 60) h, m = divmod(m, 60) print "%d:%02d:%02d" % (h, m, s) You can use datetime.timedelta function: >>> import datetime >>> str(datetime.timedelta(seconds=666)) '0:11:06'
-
只需将POSIXlt data.type转换为POSIXlt POSIXct mutate(df, DTHR_EVENT = as.POSIXct(strptime(DTHR_EVENT, "%Y%m%d%H%M%S"))) 看到这个github问题 Just convert the POSIXlt data.type to POSIXct mutate(df, DTHR_EVENT = as.POSIXct(strptime(DTHR_EVENT, "%Y%m%d%H%M%S"))) See this ...
-
据我所知,你有两个问题: 在第一次执行后,您将更改在h1中显示的文本的模式。 首先你有02:03:05:59 。 然后你想写02 days 03:05:58到标签。 下次你解析它时,你会得到错误,因为你拆分为:并且由于你有days而不再使用它,因为它是第一部分的分隔符。 在计算分钟时,您还应该减去天数而不仅仅是小时数。 当你想保持dd:hh:mm:ss格式时,你可以这样做: $(document).ready(function() { setInterval(function() { $(' ...
-
#!/bin/bash DATE1=$(date +%s) # ... your commands DATE2=$(date +%s) DIFF=$(awk -vdate1=$DATE1 -vdate2=$DATE2 'BEGIN{print strftime("%H hour %M minutes %S seconds",date2-date1,1)}') echo $DIFF 时间转换为秒并存储在变量DATE1和DATE2前置条件DATE2> DATE1中 DATE1=$(date +%s) ...
-
在熊猫中以“%Y%M%D”的形式将日期转换为“%Y%M%D%H%M%S”(Convert date in form of “%Y%M%D” to “%Y%M%D%H%M%S” in pandas)[2023-03-01]
如果尚未转换为datetime,则可以调用apply并使用datetime.strftime进行格式化: In [212]: df['Date'] = pd.to_datetime(df['Date']) df['Date'] Out[212]: index 0 2012-05-15 1 2012-05-16 2 2012-05-17 3 2012-05-18 4 2012-05-21 Name: Date, dtype: datetime64[ns] In [213]: impor ... -
你的问题是结局:在第一场比赛中“吃”下一场比赛的开始。 你可以使用零宽度的字边界: $this_video_duration =~ s/\b\d\b/0$&/g; \b将在\w\W或\W\w之间匹配, \d在\w 。 在这里演示 。 Your issue is that the ending : in a first match is "eating" the beginning : of the next match. You could use zero width word boundary: $t ...
-
由于ISO 8601允许持续时间字符串中的各个字段溢出,因此您可以将“PT”添加到秒数并附加“S”: int secs = 4711; String iso8601format = "PT" + secs + "S"; 这将输出“PT4711S”,相当于“PT1H18M31S”。 Since ISO 8601 allows for the individual fields in a duration string to overflow, you could just prepend "PT" to t ...
-
Python - 如何将ctime转换为'%m /%d /%Y%H:%M:%S'(Python - how to convert ctime to '%m/%d/%Y %H:%M:%S')[2022-04-06]
在您的示例中,您可以使用datetime.now : from datetime import datetime d = datetime.now() d.strftime('%m/%d/%Y %H:%M:%S') Out[7]: '11/06/2013 18:59:38' 但。 如果您从其他地方接收ctime样式字符串,请使用datetime.strptime解析它,然后使用datetime的strftime (而不是time )以您希望的方式对其进行格式化。 from datetime import ... -
R:将文本持续时间(“..d ..h ..m ..s”)转换为秒(R: convert text duration (“..d ..h ..m ..s”) into seconds)[2023-09-22]
我们可以使用gsub改变空格字符( \\s+ ),然后我们可以用gsubfn替换'd','h','m','s'并循环输出并计算字符串。 library(gsubfn) v2 <- gsubfn("[a-z]", list(d="*24*60*60", h = "*60*60", m = "*60", s="*1"), gsub("\\s+", "+", v1)) unname(sapply(v2, function(x) eval(parse(text=x)))) #[1] 86890197 ...