changlin31 / BossNAS

(ICCV 2021) BossNAS: Exploring Hybrid CNN-transformers with Block-wisely Self-supervised Neural Architecture Search
137 stars 20 forks source link

Question about the code of searching second Hytra block. #10

Open zhy0860 opened 2 years ago

zhy0860 commented 2 years ago

Hi, appreciate it for your time.

I find an issue in the code of Hytra search phase. When searching for the second block, after the first evaluation the chosen best path of the second block will be appended after the best path of the first block, then the training process is conducted in a three block structure.

Detailed codes are as follows: (val_hook.py) if self.every_n_epochs(runner, block_inteval): best_path = results[0][0] best_path = [int(i) for i in list(best_path)]

        if len(model.best_paths) == model.start_block + 1:
            model.best_paths.pop()
        model.best_paths.append(best_path)

(siamese_supernets_hytra.py ) if self.start_block > 0: for i, best_path in enumerate(self.best_paths): img_v1 = self.online_backbone(img_v1, start_block=i, forward_op=best_path, block_op=True)[0] img_v2 = self.online_backbone(img_v2, start_block=i, forward_op=best_path, block_op=True)[0]

In other word, the searching is not continued afte a frozen best path of previous block, but with two, the best path of the current block chosen by each evaluation stage is also freezed and appended, it means the path of second block will appear twice during searching. I can't understand why doing so.

It will lead to an issue that if the downsampling is used in the freezed best path of the second block. For instance, suppose the spatial resolution has already reached the smallest scale 1/32 in the freezed previous best path of second block, when continuing searcing if the downsampling is occured again in the current path of second block, there will be an error of mismatch in shape. It makes me confused and we did encounter this problem in our implemetation.

I'm sorry if I haven't described the issue clearly. Thanks a lot for your time again and I'm looking forward to your reply.

changlin31 commented 2 years ago

Thank you for pointing that out. It seems a bug produced by reorganization of the code. The path shouldn't appear twice. I will let you know when I fix it.

zhy0860 commented 2 years ago

Appreciate it a lot.