博客
关于我
concurrent.futures dataset
阅读量:89 次
发布时间:2019-02-26

本文共 1322 字,大约阅读时间需要 4 分钟。

通过测试发现并未发现比多线程块更高效的方式来处理图片数据

以下是所需的主要库和模块:

import datetime

import os

import threading

from concurrent.futures import ThreadPoolExecutor

import numpy as np

import logging

import cv2

import torch

from torch.utils.data import Dataset

import xml.etree.ElementTree as ET

from common import data_transforms

CLASSES = ('mouse',)

def aaa(listDataset): for index in range(len(listDataset.img_files)): if index in listDataset.img_d: pass else: img_path = listDataset.img_files[index % len(listDataset.img_files)].rstrip() img = cv2.imread(img_path, cv2.IMREAD_COLOR) if img is None: raise Exception("读取图片错误:{}".format(img_path)) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) h, w, c = img.shape label_path =

注意:上述优化后的代码主要进行了以下调整:

  • 删除了不必要的空格和格式化符号
  • 保持了代码的基本逻辑和功能
  • 使用了更简洁的语言表达
  • 保持了代码的可读性和可维护性
  • 保持了与搜索引擎友好的结构
  • 如果需要进一步优化或补充具体功能,请提供更多细节。

    转载地址:http://tsfk.baihongyu.com/

    你可能感兴趣的文章
    python出现 unknown encoding: idna 的处理方法
    查看>>
    Python出现 RuntimeError: dictionary changed size during iteration 的解决方法
    查看>>
    Python-numpy(2)数组的操作
    查看>>
    Python-Numpy的tile函数用法
    查看>>
    python-open函数
    查看>>
    Python-Pandas-将特定函数应用于给定级别-多索引数据框架
    查看>>
    python-queue队列通信
    查看>>
    python-ros No module named PyKDL
    查看>>
    python-social-auth 是否需要会话
    查看>>
    Python再获年度编程语言,微软或成最大赢家
    查看>>
    python-week5
    查看>>
    Python写表情包搜索工具(非常详细)零基础入门到精通,收藏这一篇就够了
    查看>>
    Python-【1】配置
    查看>>
    Python-从子文件夹执行绝对导入
    查看>>
    Python-刷新页面,直到元素可单击
    查看>>
    PYTHON-唤醒+VOSK+DEEPSEEK+离线合成-实现纯离线大模型问答
    查看>>
    Python-在Dash回调中重用函数
    查看>>
    PYTHON-基本数据类型-元祖类型,字典类型,集合类型
    查看>>
    python-外观模式
    查看>>
    Python-如何使用FastAPI和uvicorn.run而不阻塞线程?
    查看>>