未验证 提交 aa2500cf 编写于 作者: G Guanghua Yu 提交者: GitHub

fix obj365 label and config (#2330)

上级 04340a59
......@@ -189,7 +189,7 @@ TestReader:
fields: ['image', 'im_info', 'im_id', 'im_shape']
dataset:
!ImageFolder
anno_path: annotations/instances_val2017.json
anno_path: dataset/coco/objects365_label.txt
sample_transforms:
- !DecodeImage
to_rgb: true
......
......@@ -221,10 +221,12 @@ EvalReader:
worker_num: 2
TestReader:
inputs_def:
fields: ['image', 'im_info', 'im_id', 'im_shape']
batch_size: 1
dataset:
!ImageFolder
anno_path: dataset/obj365/annotations/val.json
anno_path: dataset/coco/objects365_label.txt
sample_transforms:
- !DecodeImage
to_rgb: True
......
person
sneakers
chair
hat
lamp
bottle
cabinet/shelf
cup
car
glasses
picture/frame
desk
handbag
street lights
book
plate
helmet
leather shoes
pillow
glove
potted plant
bracelet
flower
tv
storage box
vase
bench
wine glass
boots
bowl
dining table
umbrella
boat
flag
speaker
trash bin/can
stool
backpack
couch
belt
carpet
basket
towel/napkin
slippers
barrel/bucket
coffee table
suv
toy
tie
bed
traffic light
pen/pencil
microphone
sandals
canned
necklace
mirror
faucet
bicycle
bread
high heels
ring
van
watch
sink
horse
fish
apple
camera
candle
teddy bear
cake
motorcycle
wild bird
laptop
knife
traffic sign
cell phone
paddle
truck
cow
power outlet
clock
drum
fork
bus
hanger
nightstand
pot/pan
sheep
guitar
traffic cone
tea pot
keyboard
tripod
hockey
fan
dog
spoon
blackboard/whiteboard
balloon
air conditioner
cymbal
mouse
telephone
pickup truck
orange
banana
airplane
luggage
skis
soccer
trolley
oven
remote
baseball glove
paper towel
refrigerator
train
tomato
machinery vehicle
tent
shampoo/shower gel
head phone
lantern
donut
cleaning products
sailboat
tangerine
pizza
kite
computer box
elephant
toiletries
gas stove
broccoli
toilet
stroller
shovel
baseball bat
microwave
skateboard
surfboard
surveillance camera
gun
life saver
cat
lemon
liquid soap
zebra
duck
sports car
giraffe
pumpkin
piano
stop sign
radiator
converter
tissue
carrot
washing machine
vent
cookies
cutting/chopping board
tennis racket
candy
skating and skiing shoes
scissors
folder
baseball
strawberry
bow tie
pigeon
pepper
coffee machine
bathtub
snowboard
suitcase
grapes
ladder
pear
american football
basketball
potato
paint brush
printer
billiards
fire hydrant
goose
projector
sausage
fire extinguisher
extension cord
facial mask
tennis ball
chopsticks
electronic stove and gas stove
pie
frisbee
kettle
hamburger
golf club
cucumber
clutch
blender
tong
slide
hot dog
toothbrush
facial cleanser
mango
deer
egg
violin
marker
ship
chicken
onion
ice cream
tape
wheelchair
plum
bar soap
scale
watermelon
cabbage
router/modem
golf ball
pine apple
crane
fire truck
peach
cello
notepaper
tricycle
toaster
helicopter
green beans
brush
carriage
cigar
earphone
penguin
hurdle
swing
radio
CD
parking meter
swan
garlic
french fries
horn
avocado
saxophone
trumpet
sandwich
cue
kiwi fruit
bear
fishing rod
cherry
tablet
green vegetables
nuts
corn
key
screwdriver
globe
broom
pliers
volleyball
hammer
eggplant
trophy
dates
board eraser
rice
tape measure/ruler
dumbbell
hamimelon
stapler
camel
lettuce
goldfish
meat balls
medal
toothpaste
antelope
shrimp
rickshaw
trombone
pomegranate
coconut
jellyfish
mushroom
calculator
treadmill
butterfly
egg tart
cheese
pig
pomelo
race car
rice cooker
tuba
crosswalk sign
papaya
hair drier
green onion
chips
dolphin
sushi
urinal
donkey
electric drill
spring rolls
tortoise/turtle
parrot
flute
measuring cup
shark
steak
poker card
binoculars
llama
radish
noodles
yak
mop
crab
microscope
barbell
bread/bun
baozi
lion
red cabbage
polar bear
lighter
seal
mangosteen
comb
eraser
pitaya
scallop
pencil case
saw
table tennis paddle
okra
starfish
eagle
monkey
durian
game board
rabbit
french horn
ambulance
asparagus
hoverboard
pasta
target
hotair balloon
chainsaw
lobster
iron
flashlight
\ No newline at end of file
......@@ -492,7 +492,34 @@ def get_category_info(anno_file=None,
return coco17_category_info(with_background)
else:
logger.info("Load categories from {}".format(anno_file))
if anno_file.endswith('.json'):
return get_category_info_from_anno(anno_file, with_background)
else:
return get_category_info_from_txt(anno_file, with_background)
def get_category_info_from_txt(anno_file, with_background=True):
"""
Get class id to category id map and category id
to category name map from txt file.
args:
anno_file (str): label txt file path.
with_background (bool, default True):
whether load background as class 0.
"""
with open(anno_file, "r") as f:
catid_list = f.readlines()
clsid2catid = {}
catid2name = {}
for i, catid in enumerate(catid_list):
catid = catid.strip('\n\t\r')
clsid2catid[i + int(with_background)] = i + 1
catid2name[i + int(with_background)] = catid
if with_background:
clsid2catid.update({0: 0})
catid2name.update({0: 'background'})
return clsid2catid, catid2name
def get_category_info_from_anno(anno_file, with_background=True):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册