未验证 提交 63cf3ba4 编写于 作者: L littletomatodonkey 提交者: GitHub

fix imread (#824)

* fix imread

* rm unused decode

* rm decode
上级 a59ac4fb
......@@ -60,19 +60,22 @@ Optimizer:
DataLoader:
Train:
dataset:
name: ICartoonDataset
image_root: "./dataset/iCartoonFace"
cls_label_path: "./dataset/iCartoonFace/train_list.txt"
transform_ops:
- RandCropImage:
size: 224
- RandFlipImage:
flip_code: 1
- NormalizeImage:
scale: 0.00392157
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
order: ''
name: ICartoonDataset
image_root: "./dataset/iCartoonFace"
cls_label_path: "./dataset/iCartoonFace/train_list.txt"
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- RandCropImage:
size: 224
- RandFlipImage:
flip_code: 1
- NormalizeImage:
scale: 0.00392157
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
order: ''
sampler:
name: DistributedBatchSampler
#num_instances: 2
......@@ -86,27 +89,30 @@ DataLoader:
Eval:
Query:
dataset:
name: ICartoonDataset
image_root: "./dataset/iCartoonFace"
cls_label_path: "./dataset/iCartoonFace/query.txt"
transform_ops:
- ResizeImage:
resize_short: 256
- CropImage:
size: 224
- NormalizeImage:
scale: 0.00392157
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
order: ''
name: ICartoonDataset
image_root: "./dataset/iCartoonFace"
cls_label_path: "./dataset/iCartoonFace/query.txt"
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
resize_short: 256
- CropImage:
size: 224
- NormalizeImage:
scale: 0.00392157
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
order: ''
sampler:
name: DistributedBatchSampler
batch_size: 64
drop_last: False
shuffle: False
loader:
num_workers: 6
use_shared_memory: False
num_workers: 8
use_shared_memory: True
Gallery:
dataset:
......@@ -114,6 +120,9 @@ DataLoader:
image_root: "./dataset/iCartoonFace"
cls_label_path: "./dataset/iCartoonFace/gallery.txt"
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
resize_short: 256
- CropImage:
......@@ -129,8 +138,8 @@ DataLoader:
drop_last: False
shuffle: False
loader:
num_workers: 6
use_shared_memory: False
num_workers: 8
use_shared_memory: True
Metric:
Train:
......
......@@ -49,6 +49,9 @@ DataLoader:
image_root: ./dataset/ILSVRC2012/
cls_label_path: ./dataset/ILSVRC2012/train_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- RandCropImage:
size: 224
- RandFlipImage:
......@@ -76,6 +79,9 @@ DataLoader:
image_root: ./dataset/ILSVRC2012/
cls_label_path: ./dataset/ILSVRC2012/val_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
resize_short: 256
- CropImage:
......
......@@ -50,6 +50,9 @@ DataLoader:
image_root: ./dataset/ILSVRC2012/
cls_label_path: ./dataset/ILSVRC2012/train_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- RandCropImage:
size: 224
- RandFlipImage:
......@@ -76,6 +79,9 @@ DataLoader:
image_root: ./dataset/ILSVRC2012/
cls_label_path: ./dataset/ILSVRC2012/val_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
resize_short: 256
- CropImage:
......
......@@ -65,6 +65,9 @@ DataLoader:
image_root: "dataset/LogoDet-3K-crop/train/"
cls_label_path: "dataset/LogoDet-3K-crop/LogoDet-3K+train.txt"
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- RandFlipImage:
......@@ -91,25 +94,28 @@ DataLoader:
Query:
# TOTO: modify to the latest trainer
dataset:
name: LogoDataset
image_root: "dataset/LogoDet-3K-crop/val/"
cls_label_path: "LogoDet-3K-crop/LogoDet-3K+query.txt"
transform_ops:
- ResizeImage:
size: 224
- NormalizeImage:
scale: 0.00392157
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
order: ''
name: LogoDataset
image_root: "dataset/LogoDet-3K-crop/val/"
cls_label_path: "LogoDet-3K-crop/LogoDet-3K+query.txt"
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- NormalizeImage:
scale: 0.00392157
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
order: ''
sampler:
name: DistributedBatchSampler
batch_size: 128
drop_last: False
shuffle: False
loader:
num_workers: 10
use_shared_memory: False
num_workers: 8
use_shared_memory: True
Gallery:
# TOTO: modify to the latest trainer
......@@ -118,6 +124,9 @@ DataLoader:
image_root: "dataset/LogoDet-3K-crop/train/"
cls_label_path: "dataset/LogoDet-3K-crop/LogoDet-3K+gallery.txt"
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- NormalizeImage:
......@@ -131,8 +140,8 @@ DataLoader:
drop_last: False
shuffle: False
loader:
num_workers: 10
use_shared_memory: False
num_workers: 8
use_shared_memory: True
Metric:
Eval:
......@@ -145,14 +154,14 @@ Infer:
infer_imgs: "docs/images/whl/demo.jpg"
batch_size: 10
transforms:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
resize_short: 224
- NormalizeImage:
scale: 1.0/255.0
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
order: ''
- ToCHWImage:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
resize_short: 224
- NormalizeImage:
scale: 1.0/255.0
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
order: ''
- ToCHWImage:
......@@ -60,6 +60,9 @@ DataLoader:
image_root: ./dataset/Aliproduct/
cls_label_path: ./dataset/Aliproduct/train_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- RandFlipImage:
......@@ -85,6 +88,9 @@ DataLoader:
image_root: ./dataset/Aliproduct/
cls_label_path: ./dataset/Aliproduct/val_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
resize_short: 256
- CropImage:
......
......@@ -74,6 +74,9 @@ DataLoader:
image_root: ./dataset/Inshop/
cls_label_path: ./dataset/Inshop/train_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- RandFlipImage:
......@@ -106,6 +109,9 @@ DataLoader:
image_root: ./dataset/Inshop/
cls_label_path: ./dataset/Inshop/query_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- NormalizeImage:
......@@ -128,6 +134,9 @@ DataLoader:
image_root: ./dataset/Inshop/
cls_label_path: ./dataset/Inshop/gallery_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- NormalizeImage:
......
......@@ -73,6 +73,9 @@ DataLoader:
image_root: ./dataset/Stanford_Online_Products/
cls_label_path: ./dataset/Stanford_Online_Products/train_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- RandFlipImage:
......@@ -105,6 +108,9 @@ DataLoader:
image_root: ./dataset/Stanford_Online_Products/
cls_label_path: ./dataset/Stanford_Online_Products/test_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- NormalizeImage:
......@@ -127,6 +133,9 @@ DataLoader:
image_root: ./dataset/Stanford_Online_Products/
cls_label_path: ./dataset/Stanford_Online_Products/test_list.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- NormalizeImage:
......
......@@ -71,6 +71,9 @@ DataLoader:
bbox_crop: True
cls_label_path: "/work/dataset/CompCars/train_test_split/classification/train_label.txt"
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- RandFlipImage:
......@@ -96,18 +99,21 @@ DataLoader:
drop_last: False
shuffle: True
loader:
num_workers: 6
use_shared_memory: False
num_workers: 8
use_shared_memory: True
Eval:
# TOTO: modify to the latest trainer
dataset:
name: "CompCars"
image_root: "/work/dataset/CompCars/image/"
label_root: "/work/dataset/CompCars/label/"
cls_label_path: "/work/dataset/CompCars/train_test_split/classification/test_label.txt"
image_root: ".dataset/CompCars/image/"
label_root: "./dataset/CompCars/label/"
cls_label_path: "./dataset/CompCars/train_test_split/classification/test_label.txt"
bbox_crop: True
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- NormalizeImage:
......@@ -121,8 +127,8 @@ DataLoader:
drop_last: False
shuffle: False
loader:
num_workers: 6
use_shared_memory: False
num_workers: 8
use_shared_memory: True
Infer:
infer_imgs: "docs/images/whl/demo.jpg"
......
......@@ -69,6 +69,9 @@ DataLoader:
image_root: "/work/dataset/VeRI-Wild/images/"
cls_label_path: "/work/dataset/VeRI-Wild/train_test_split/train_list_start0.txt"
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- RandFlipImage:
......@@ -104,6 +107,9 @@ DataLoader:
image_root: "/work/dataset/VeRI-Wild/images"
cls_label_path: "/work/dataset/VeRI-Wild/train_test_split/test_3000_id_query.txt"
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- NormalizeImage:
......@@ -127,6 +133,9 @@ DataLoader:
image_root: "/work/dataset/VeRI-Wild/images"
cls_label_path: "/work/dataset/VeRI-Wild/train_test_split/test_3000_id.txt"
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- ResizeImage:
size: 224
- NormalizeImage:
......
......@@ -63,8 +63,8 @@ class CommonDataset(Dataset):
def __getitem__(self, idx):
try:
img = cv2.imread(self.images[idx])
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
with open(self.images[idx], 'rb') as f:
img = f.read()
if self._transform_ops:
img = transform(img, self._transform_ops)
img = img.transpose((2, 0, 1))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册