MMpretrain使用Tiny ImageNet数据集

news/2025/1/23 9:21:27/文章来源:https://www.cnblogs.com/mstk/p/18510556

Tiny ImageNet是ImageNet的子集,ImageNet太大了,训练一次要好几天,于是准备用Tiny ImageNet代替ImageNet.

/mmpretrain/mmpretrain/datasets/imagenet.py里面列出了ImageNet的两种格式:

        imagenet├── train│   ├──class_x|   |   ├── x1.jpg|   |   ├── x2.jpg|   |   └── ...│   ├── class_y|   |   ├── y1.jpg|   |   ├── y2.jpg|   |   └── ...|   └── ...├── val│   ├──class_x|   |   └── ...│   ├── class_y|   |   └── ...|   └── ...└── test├── test1.jpg├── test2.jpg└── ...

或者:

        imagenet├── train│   ├── x1.jpg│   ├── y1.jpg│   └── ...├── val│   ├── x3.jpg│   ├── y3.jpg│   └── ...├── test│   ├── test1.jpg│   ├── test2.jpg│   └── ...└── meta├── train.txt└── val.txt

编写一个python小程序将解压后的Tiny ImageNet转化为上面两种格式种的任意一种即可:

修改/mmpretrain/mmpretrain/datasets/categories.py文件,在里面加上下面的类列表:

TINY_IMAGENET_CATEGORIES = ('Egyptian cat','reel','volleyball','rocking chair, rocker','lemon','bullfrog, Rana catesbeiana','basketball','cliff, drop, drop-off','espresso',"plunger, plumber's helper",'parking meter','German shepherd, German shepherd dog, German police dog, alsatian','dining table, board','monarch, monarch butterfly, milkweed butterfly, Danaus plexippus','brown bear, bruin, Ursus arctos','school bus','pizza, pizza pie','guinea pig, Cavia cobaya','umbrella','organ, pipe organ','oboe, hautboy, hautbois','maypole','goldfish, Carassius auratus','potpie','hourglass','seashore, coast, seacoast, sea-coast','computer keyboard, keypad','Arabian camel, dromedary, Camelus dromedarius','ice cream, icecream','nail','space heater','cardigan','baboon','snail','coral reef','albatross, mollymawk',"spider web, spider's web",'sea cucumber, holothurian','backpack, back pack, knapsack, packsack, rucksack, haversack','Labrador retriever','pretzel','king penguin, Aptenodytes patagonica','sulphur butterfly, sulfur butterfly','tarantula','lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens','pop bottle, soda bottle','banana','sock','cockroach, roach','projectile, missile','beer bottle','mantis, mantid','freight car','guacamole','remote control, remote','European fire salamander, Salamandra salamandra','lakeside, lakeshore','chimpanzee, chimp, Pan troglodytes','pay-phone, pay-station','fur coat','alp','lampshade, lamp shade','torch','abacus','moving van','barrel, cask','tabby, tabby cat','goose','koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus','bullet train, bullet','CD player','teapot','birdhouse','gazelle',"academic gown, academic robe, judge's robe",'tractor','ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle','miniskirt, mini','golden retriever','triumphal arch','cannon','neck brace','sombrero','gasmask, respirator, gas helmet','candle, taper, wax light','desk','frying pan, frypan, skillet','bee','dam, dike, dyke','spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish','police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria','iPod','punching bag, punch bag, punching ball, punchball','beacon, lighthouse, beacon light, pharos','jellyfish','wok','potter\'s wheel','sandal','pill bottle','butcher shop, meat market','slug','hog, pig, grunter, squealer, Sus scrofa','cougar, puma, catamount, mountain lion, painter, panther, Felis concolor','crane','vestment',"dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",'cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM','mushroom','jinrikisha, ricksha, rickshaw','water tower','chest','snorkel','sunglasses, dark glasses, shades','fly','limousine, limo','black stork, Ciconia nigra','dugong, Dugong dugon','sports car, sport car','water jug','suspension bridge','ox','ice lolly, lolly, lollipop, popsicle','turnstile','Christmas stocking','broom','scorpion','wooden spoon','picket fence, paling','rugby ball','sewing machine','steel arch bridge','Persian cat','refrigerator, icebox','barn','apron','Yorkshire terrier','swimming trunks, bathing trunks','stopwatch, stop watch','lawn mower, mower','thatch, thatched roof','fountain','black widow, Latrodectus mactans','bikini, two-piece','plate','teddy, teddy bear','barbershop','confectionery, confectionary, candy store','beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon','scoreboard','orange','flagpole, flagstaff','American lobster, Northern lobster, Maine lobster, Homarus americanus','trolleybus, trolley coach, trackless trolley','drumstick','dumbbell','brass, memorial tablet, plaque','bow tie, bow-tie, bowtie','convertible','bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis','orangutan, orang, orangutang, Pongo pygmaeus','American alligator, Alligator mississipiensis','centipede','syringe','go-kart','brain coral','sea slug, nudibranch','cliff dwelling','mashed potato','viaduct','military uniform','pomegranate','chain','kimono','comic book','trilobite','bison','pole','boa constrictor, Constrictor constrictor','poncho','bathtub, bathing tub, bath, tub','grasshopper, hopper','walking stick, walkingstick, stick insect','Chihuahua','tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui','lion, king of beasts, Panthera leo','altar','obelisk','beaker','bell pepper','bannister, banister, balustrade, balusters, handrail','bucket, pail','magnetic compass','meat loaf, meatloaf','gondola','standard poodle','acorn','lifeboat','binoculars, field glasses, opera glasses','cauliflower','African elephant, Loxodonta africana')

最后,将相关模型文件里面的num_classes从1000改成200,就可以运行了.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/823209.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

在markdown上显示数学函数与数学函数图像

前言 这里分享数学函数与函数图像显示在markdown上的方式markdown编辑器 Obsidian 和 Typora数学函数显示 打开编辑器 (这里以Typora为例) 基础到可以忽略符号 html中以 & 开头, 以 ;结尾的特殊符号是可以直接输入在编辑器上显示的 图片上的显示结果即按照html源代码的格式…

如何进行颜色选择

进行颜色选择的步骤:1. 理解颜色理论;2. 考虑品牌标识和情感;3. 使用工具和资源;4. 进行A/B测试;5. 不要忽视辅助色。颜色理论是颜色选择的基础。它有助于您理解不同颜色之间的关系,以及它们如何在设计中共同协作。1. 理解颜色理论 颜色理论是颜色选择的基础。它有助于您…

C#学习 顶级语句(9)

代码与输出命名空间与类型定义 using ConsoleApp1.basic;FibonacciSequence.Run(20);MyClass.Hello(); MyNameSpace.MyClass.Hello();if (args.Length > 0) {Console.WriteLine("args的数目大于0."); } else {Console.WriteLine("args的数目为0."); }pu…

Origin2024中如何绘制雷达图?

雷达图是以从同一点开始的轴上表示的三个或更多个定量/变量的二维图表,轴径向排列显示多变量数据,也称为网络图,蜘蛛网图或星图等操作步骤: 1、先打开Origin2024软件,然后在Book1中输入如下示例数据,选中两列数据:2、点击菜单栏中【绘图】→【专业图】→【雷达图】: 3…

第10课 数据库之多表运用

一、多表查询 1、什么是多表关联查询 从2个表或者更多的表中查询我们需要的数据 2、多表连接的关系? (1)内连接 (2)左连接 (3)右连接 (4)左独有数据 (5)右独有数据 (6)全外连接 比如: a 表:1,2,3 b 表:1,2,4 内连接:显示左边12和右边12关联 …

明明花了大价钱,为什么你的CMDB还是用不起来?

明明是谁?你果然在外面有狗子了! 在IT服务管理(ITSM)的世界里,CMDB(配置管理数据库)被看作是连接各个管理流程的桥梁,它记录了IT环境中所有配置项(CI)的详细信息及其相互关系。然而,在实践中,许多组织尽管投入了大量资源来构建和维护CMDB,却发现CMDB难以有效使用。…

Nuxt.js 应用中的 imports:extend 事件钩子详解

title: Nuxt.js 应用中的 imports:extend 事件钩子详解 date: 2024/10/28 updated: 2024/10/28 author: cmdragon excerpt: imports:extend 是 Nuxt.js 中的一个生命周期钩子,允许开发者在模块设置过程中扩展导入。使用此钩子,开发者可以灵活地管理和调整模块的导入配置,从…

3、整体布局

1、布局大概如下:2、修改App.vue,增加菜单<template><div class="layout"><el-container class="container"><el-aside class="aside"><!--系统名称+logo--><div class="head"><div><…

ctfshow-misc29

010editor修改gif的高度,批量96 00全部换成FF 00,保存后,逐帧查看,会发现flag。

Webpack搭建本地服务器

为什么要搭建本地服务器webpack-dev-server认识模块热替换(HMR)开启HMR框架的HMR

深入理解openstack neutron

1. neutron network数据结构说明网络分为租户网络和运营商网络,租户网络由租户创建,运营商网络由管理员创建 网络结构里没有网络类型和vlanid,vni这些信息的字段,是由配置文件决定的# [etc/neutron/plugins/ml2/ml2_conf.ini] tenant_network_types = vxlan [ml2_type_vxla…

【Java】【SpringBoot】logback开发环境配置

LogBack开发环境配置 Logback是一个开源的日志记录库,它是log4j的一个改进版本 。Logback被设计为易于使用,同时提供强大的日志管理功能。 1.添加依赖 在pom.xml文件中添加依赖: <dependency><groupId>ch.qos.logback</groupId><artifactId>logback…