After that, I trained on the code you released. And I found that the data loader is slow, in this case, I used logical operations to speed up the process. Here is my code.
def getSaliency(mask):
# one combined category: HD/RO/FV/WR
"""
RGB color code and object categories:
------------------------------------
000 BW: Background waterbody
001 HD: Human divers
010 PF: Plants/sea-grass
011 WR: Wrecks/ruins
100 RO: Robots/instruments
101 RI: Reefs and invertebrates
110 FV: Fish and vertebrates
111 SR: Sand/sea-floor (& rocks)
"""
imw, imh = mask.shape[0], mask.shape[1]
sal = np.zeros((imw, imh))
# bkg = np.zeros((imw,imh))
a = np.logical_and(np.logical_and(np.logical_not(mask[:, :, 0]),np.logical_not(mask[:,:, 1])),mask[:, :, 2])
sal[a] = 1
a = np.logical_and(np.logical_and(np.logical_not(mask[:, :, 2]), np.logical_not(mask[:, :, 1])), mask[:, :, 0])
sal[a] = 1
a = np.logical_and(np.logical_and(mask[:,:,0],mask[:,:,1]),np.logical_not(mask[:,:,2]))
sal[a] = 1
a = np.logical_and(np.logical_and(mask[:, :, 1], mask[:, :, 2]), np.logical_not(mask[:, :, 0]))
sal[a] = 1
return np.expand_dims(sal, axis=-1)
def getRobotFishHumanReefWrecks(mask):
# for categories: HD, RO, FV, WR, RI
imw, imh = mask.shape[0], mask.shape[1]
mask = np.rint(mask)
Human = np.zeros((imw, imh))
Robot = np.zeros((imw, imh))
Fish = np.zeros((imw, imh))
Reef = np.zeros((imw, imh))
Wreck = np.zeros((imw, imh))
a = np.logical_and(np.logical_and(np.logical_not(mask[:, :, 0]),np.logical_not(mask[:,:, 1])),mask[:, :, 2])
Human[a] = 1
a = np.logical_and(np.logical_and(np.logical_not(mask[:, :, 2]), np.logical_not(mask[:, :, 1])), mask[:, :, 0])
Robot[a] = 1
a = np.logical_and(np.logical_and(mask[:,:,0],mask[:,:,1]),np.logical_not(mask[:,:,2]))
Fish[a] = 1
a = np.logical_and(np.logical_and(mask[:, :, 0], mask[:, :, 2]), np.logical_not(mask[:, :, 1]))
Reef[a] = 1
a = np.logical_and(np.logical_and(mask[:, :, 1], mask[:, :, 2]), np.logical_not(mask[:, :, 0]))
Wreck[a] = 1
return np.stack((Robot, Fish, Human, Reef, Wreck), -1) �
However, I did not get the same size model as you released on google drive. After I check on the Internet, I change
save_weights_only = True
to
save_weights_only = False
But my model is still 2KB smaller than yours. And the result I tested was still bad. I got 10-20% fewer results than the different types of IOU in the paper. To improve the result, I change the batch size from 2 to 32, but similarly, the result is still bad.