Image augmentation list is missing : How to verify whether applied augmentation worked or not ??
See original GitHub issueInstructions To Reproduce the 🐛 Bug:
- Full runnable code or full changes you made:
If making changes to the project itself, please use output of the following command:
git rev-parse HEAD; git diff
<put code or diff here>
def custom_mapper(dataset_dict):
# Implement a mapper, similar to the default DatasetMapper, but with your own customizations
dataset_dict = copy.deepcopy(dataset_dict) # it will be modified by code below
image = utils.read_image(dataset_dict["file_name"], format="BGR")
augs = T.AugmentationList([
T.RandomBrightness(0.5, 2),
T.RandomContrast(0.5, 2),
T.RandomSaturation(0.5, 2),
T.RandomFlip(prob=0.5, horizontal=False, vertical=True),
T.RandomFlip(prob=0.5, horizontal=True, vertical=False)
])
auginput = T.AugInput(image)
transform = augs(auginput)
image = torch.as_tensor(image.transpose(2, 0, 1).astype("float32"))
dataset_dict["image"] = image
annos = [
utils.transform_instance_annotations(obj, [transform], image.shape[1:])
for obj in dataset_dict.pop("annotations")
]
instances = utils.annotations_to_instances(annos, image.shape[1:])
dataset_dict["instances"] = utils.filter_empty_instances(instances)
return dataset_dict
class BaseTrainer(engine.DefaultTrainer):
def __init__(self, cfg):
super().__init__(cfg)
@classmethod
def build_train_loader(cls, cfg):
return build_detection_train_loader(cfg, mapper=custom_mapper)
@classmethod
def build_evaluator(cls, cfg, dataset_name, output_folder=None):
if output_folder is None:
output_folder = os.path.join(cfg.OUTPUT_DIR, "inference")
return COCOEvaluator(dataset_name, cfg, True, output_folder)
def build_hooks(self):
hooks = super().build_hooks()
hooks.insert(-1, Basehook(
self.cfg.TEST.EVAL_PERIOD,
self.model,
build_detection_test_loader(
self.cfg,
self.cfg.DATASETS.TEST[0],
DatasetMapper(self.cfg, True)
)
))
return hooks
return hooks
- please simplify the steps as much as possible so they do not require additional resources to run, such as a private dataset.
I applied :
augs = T.AugmentationList([ T.RandomBrightness(0.5, 2), T.RandomContrast(0.5, 2), T.RandomSaturation(0.5, 2), T.RandomFlip(prob=0.5, horizontal=False, vertical=True), T.RandomFlip(prob=0.5, horizontal=True, vertical=False) ])
But while training only [ResizeShortestEdge(short_edge_length=(640, 672, 704, 736, 768, 800), max_size=1333, sample_style=‘choice’), RandomFlip()] showing. How can I verify whether augmentations applied or not ?
I have attached the screenshot for reference.
Thank you in advance
Environment:
sys.platform linux
Python 3.8.8 (default, Feb 24 2021, 21:46:12) [GCC 7.3.0]
numpy 1.19.2
detectron2 0.4 @/home/sami02/anaconda3/envs/thesis/lib/python3.8/site-packages/detectron2
Compiler GCC 9.3
CUDA compiler not available
DETECTRON2_ENV_MODULE <not set>
PyTorch 1.8.1 @/home/sami02/anaconda3/envs/thesis/lib/python3.8/site-packages/torch
PyTorch debug build False
GPU available True
GPU 0 GeForce GTX 1060 6GB (arch=6.1)
CUDA_HOME None - invalid!
Pillow 8.2.0
torchvision 0.9.1 @/home/sami02/anaconda3/envs/thesis/lib/python3.8/site-packages/torchvision
torchvision arch flags /home/sami02/anaconda3/envs/thesis/lib/python3.8/site-packages/torchvision/_C.so
fvcore 0.1.5.post20210413
iopath 0.1.7
cv2 4.5.1
---------------------- ---------------------------------------------------------------------------------
PyTorch built with:
- GCC 7.3
- C++ Version: 201402
- Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v1.7.0 (Git Hash 7aed236906b1f7a05c0917e5257a1af05e9ff683)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- NNPACK is enabled
- CPU capability usage: AVX
- CUDA Runtime 10.2
- NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
- CuDNN 7.6.5
- Magma 2.5.2
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=10.2, CUDNN_VERSION=7.6.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.8.1, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
A survey on Image Data Augmentation for Deep Learning
In addition to augmentation techniques, this paper will briefly discuss other characteristics of Data Augmentation such as test-time ...
Read more >How to Configure Image Data Augmentation in Keras
Image data augmentation is typically only applied to the training dataset, and not to the validation or test dataset.
Read more >A Comprehensive Guide to Image Augmentation using Pytorch
In this post, I am going to make a list of the best data augmentation techniques that to increase the size and the...
Read more >Data augmentation | TensorFlow Core
This tutorial demonstrates data augmentation: a technique to increase the diversity of your training set by applying random (but realistic) transformations, ...
Read more >Data Augmentation For Bounding Boxes: Flipping
In order to see whether our augmentation really worked or not, we define a helper function draw_rect which takes in img and bboxes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I use this to visualize custom data augmentation before training:
Where Trainer is your custom trainer and that your dataset is already registered. Hope it helps!
Requested information was not provided in 7 days, so we’re closing this issue.
Please open new issue if information becomes available. Otherwise, use github discussions for free-form discussions.