Multiple object classification in an image

Hello All,

My image has 5 objects, each as a row, in a 5x50 image. Any given object may belong to one of 22 (indexed from 0 till 21) total classes. am not sure how to model this problem statement to get a desired outcome to pass this to a cross entropy loss in pytorch.

Please help.