当前位置:网站首页>yolov5 test. Py broken pipe error: [errno 32] broken pipe problem solving
yolov5 test. Py broken pipe error: [errno 32] broken pipe problem solving
2022-07-23 07:56:00 【Christo3】
dataset.py
batch_size = min(batch_size, len(dataset))
nw = min([os.cpu_count() // world_size, batch_size if batch_size > 1 else 0, workers]) # number of workers
sampler = torch.utils.data.distributed.DistributedSampler(dataset) if rank != -1 else None
loader = torch.utils.data.DataLoader if image_weights else InfiniteDataLoader
# Use torch.utils.data.DataLoader() if dataset.properties will update during training else InfiniteDataLoader()
dataloader = loader(dataset,
batch_size=batch_size,
num_workers= nw,
sampler=sampler,
pin_memory=True,
collate_fn=LoadImagesAndLabels.collate_fn4 if quad else LoadImagesAndLabels.collate_fn)
return dataloader, dataset
terms of settlement
takeloaderFunctionnum_workersParameter set to 0num_worker The role of
1、 Every turn dataloader When loading data :dataloader One-time creation num_worker individual worker,( It can also be said that dataloader One-time creation num_worker Working process ,worker It's also an ordinary work process ), And use batch_sampler Will specify batch Assigned to the designated worker,worker Put it in charge of batch Load in RAM. then ,dataloader from RAM Find out what to use in this iteration batch, If you find it , Just use . If not , Will be num_worker individual worker Continue loading batch To the memory , until dataloader stay RAM Find the target in batch. In general, it can be found , because batch_sampler Appoint batch Of course, priority should be given to the... To be used in this round batch.
2、num_worker Set it big , The advantage is to find batch Fast , Because the next iteration is batch Probably in the last round / Last round … The iteration is already loaded . The disadvantage is that the memory overhead is high , It's aggravating CPU burden (worker Load data to RAM The process is CPU Copy it ).num_workers The experience setting value is your own computer / Server's CPU The core number , If CPU strong 、RAM And it's abundant , You can make it bigger .
3、 If num_worker Set to 0, It means every iteration ,dataloader No more self loading data to RAM This step ( Because no worker 了 ), But in RAM In looking for batch, When it cannot be found, load the corresponding batch. The disadvantage, of course, is that it's slower .
边栏推荐
- About redis, do you update the database first or the cache first?
- 1.10 API 和字符串
- How to open the file in keil is the real path in the 109th blog of fledgling Xiao Li
- 93. (leaflet chapter) leaflet situation plotting - modification of attack direction
- 6-14漏洞利用-rpcbind漏洞利用
- 船新 IDEA 2022.2 正式发布,新特性真香
- 程序员最想干的三件事 |漫画
- [original dry goods] found a useful tool for data analysis
- Patrick McHardy事件对开源社区的影响
- 工作流引擎在vivo营销自动化中的应用实践
猜你喜欢
随机推荐
基于ROS的导航框架
zabbix agent创建监控项
ETL tool (data synchronization)
测试用例设计方法合集
General, special and hidden attributes of the file (instance generates animation)
etcdv3·watch操作实现及相关重点说明
Scala main constructor_ Scala main constructor depth
I use the factory mode in jd.com and explain the factory mode clearly
How to use the order flow analysis tool (Part 2)
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
How to open the file in keil is the real path in the 109th blog of fledgling Xiao Li
如何优雅的改变this指向
局域网SDN技术硬核内幕 7 从二层到大二层
JVM监控工具介绍jstack, jconsole, jinfo, jmap, jdb, jstat
Detailed analysis of the 110th blog of the fledgling Xiao Li in stm32__ NVIC_ Setprioritygrouping (uint32_t prioritygroup) function
沃尔沃xc90的安全性如何?一起来看看吧
【第31天】给定一个整数 n ,求出它的每个质因数的底数与指数 | 算术基本定理
船新 IDEA 2022.2 正式发布,新特性真香
百度搜索打击盗版网文站点:互联网内容侵权现象为何屡禁不止
scala idea提示函数参数









