semantic-segmentation icon indicating copy to clipboard operation
semantic-segmentation copied to clipboard

inference with a pretrained model

Open Tsardoz opened this issue 3 years ago • 4 comments

Hi this looks great but I am a bit confused. I want to use a pretrained topformer model for inference for evaluation then maybe to use it for custom training. I am confused about the steps. I downloaded a model from here https://github.com/hustvl/TopFormer In the ade20k.yaml file what do I put for the BACKBONE (in MODEL)? Also for PRETRAINED? Or is the BACKBONE the starting weights for transfer learning?

Tsardoz avatar Jun 11 '22 07:06 Tsardoz

Hi, I am sorry for confusion. TopFormer is not updated in this repo yet. I am updating the whole codebase and will release later.

sithu31296 avatar Jun 11 '22 08:06 sithu31296

Thanks but I am still confused. If I download any segformer model from their git even the B3 used as demo (and shows it working well) I get terrible results. eg. segformer.b3.512x512.ade.160k from https://drive.google.com/drive/folders/1GAku0G0iR9DsBxCbfENWMJ27c5lYUeQA Is the format different? Do I need to retrain the model? B0 looks like it might compete with Topformer but again, terrible results with a downloaded pretrain.

Tsardoz avatar Jun 11 '22 12:06 Tsardoz

I suggest to use the pretrained models provided in this repo from here. Not all of the weights from official repositories are compatible with the modified (simplified) code base in this repo. But still it should work after modifying some of the keys and values in the pretrained weights. This is the example result I tested with the SegFormer-B2 model. The result is pretty good.

sithu31296 avatar Jun 11 '22 13:06 sithu31296

Thanks. I had seen that but the weights had not registered with me. It also says which backbone to use.

On Sat, Jun 11, 2022 at 11:24 PM sithu3 @.***> wrote:

I suggest to use the pretrained models provided in this repo from here https://github.com/sithu31296/semantic-segmentation/blob/main/docs/MODELS.md. Not all of the weights from official repositories are compatible with the modified (simplified) code base in this repo. But still it should work after modifying some of the keys and values in the pretrained weights. This is the example result https://github.com/sithu31296/semantic-segmentation/blob/main/assests/infer_result.png I tested with the SegFormer-B2 model. The result is pretty good.

— Reply to this email directly, view it on GitHub https://github.com/sithu31296/semantic-segmentation/issues/39#issuecomment-1152927799, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOIPDBJOSTTYXCSJT2UULLVOSHSTANCNFSM5YPVRI3A . You are receiving this because you authored the thread.Message ID: @.***>

Tsardoz avatar Jun 11 '22 17:06 Tsardoz