If you just have two exclusive target classes and would like to use nn.BCELoss, you have to add a nn.Sigmoid() layer as your output layer into your model and also use a target between 0 and 1.
Otherwise if your use case is a multi-label classification, i.e. both classes can be true at the same time for the same pixel, you could use two outputs for your model.
The focal loss implementation seems to use F.cross_entropy internally, so you should remove any non-linearities applied on your model output and pass the 2 channel output directly to your criterion.