Megvii-BaseDetection / Megvii-BaseDetection/YOLOX
How to change imput size with random resize ?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
想把模型的输入尺寸设置成1280x720,并使用随机缩放,应该怎么改?
直接改exp的input_size并没有用,因为输入大小是由random_size控制的,input_size只提供比例因子size_factor 。
# random resizing
if self.exp.random_size is not None and (self.progress_in_iter + 1) % 10 == 0:
self.input_size = self.exp.random_resize(
self.train_loader, self.epoch, self.rank, self.is_distributed
)
def random_resize(self, data_loader, epoch, rank, is_distributed):
tensor = torch.LongTensor(2).cuda()
if rank == 0:
size_factor = self.input_size[1] * 1. / self.input_size[0]
size = random.randint(*self.random_size)
size = (int(32 * size), 32 * int(size * size_factor))
tensor[0] = size[0]
tensor[1] = size[1]
if is_distributed:
dist.barrier()
dist.broadcast(tensor, 0)
input_size = data_loader.change_input_dim(
multiple=(tensor[0].item(), tensor[1].item()), random_range=None
)
return input_size
也试过设置self.random_size = (34, 46),能在[1088, 1472]范围内训练,但是评估的精度为0.
所以,想把模型的输入尺寸设置成1280x720,并使用随机缩放,应该怎么改?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the exp input_size and random_size settings through random_resize and data_loader.change_input_dim. Verify how the 1280x720 aspect ratio and random training dimensions reach evaluation, using the shown resizing code as the entry point. Done means random resizing preserves the requested ratio and evaluation no longer produces zero precision.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100