yangxue0827 / RotationDetection

This is a tensorflow-based rotation detection benchmark, also called AlphaRotate.
https://rotationdetection.readthedocs.io/
Apache License 2.0
1.08k stars 181 forks source link

Focal Loss and Preprocessing Images #71

Closed Testbild closed 2 years ago

Testbild commented 2 years ago

Hello,

I have two questions regarding loss and preprocessing. Currently I have the issue, that the model detects objects very well, but assigns wrong classes to them. The objects I want to detect are left and right handed, so flipping the images in preprocessing/augmentation would actually let the model learn false classes. Hence my questions:

from __future__ import division, print_function, absolute_import

import numpy as np

from libs.configs._base_.models.retinanet_r50_fpn import *
from libs.configs._base_.datasets.dota_detection import *
from libs.configs._base_.schedules.schedule_1x import *
from dataloader.pretrained_weights.pretrain_zoo import PretrainModelZoo

# schedule
BATCH_SIZE = 1
GPU_GROUP = "0"
NUM_GPU = len(GPU_GROUP.strip().split(','))
SAVE_WEIGHTS_INTE = 10000 * 2
DECAY_STEP = np.array(DECAY_EPOCH, np.int32) * SAVE_WEIGHTS_INTE
MAX_ITERATION = SAVE_WEIGHTS_INTE * MAX_EPOCH
WARM_SETP = int(WARM_EPOCH * SAVE_WEIGHTS_INTE)

# dataset
DATASET_NAME = 'myClass'
CLASS_NUM = 32

# model
# backbone
pretrain_zoo = PretrainModelZoo()
PRETRAINED_CKPT = pretrain_zoo.pretrain_weight_path(NET_NAME, ROOT_PATH)
TRAINED_CKPT = os.path.join(ROOT_PATH, 'output/trained_weights')

# bbox head
ANGLE_RANGE = 180

# loss
CLS_WEIGHT = 1.0
REG_WEIGHT = 1.0 / 5.0
REG_LOSS_MODE = 0

VERSION = 'RetinaNet_myClass'

Thank you very much and best regards!

EDIT: I also think I do not know, what exactly the ANGLE_RANGE is for? Maybe you could explain this also?

yangxue0827 commented 2 years ago

image ANGLE_RANGE denotes angle definition:

Testbild commented 2 years ago

Thank you!