I have a set of 4 coordinates that I read in from a dataframe. I wish to order them from left to right. When I doing transforms such as flipLR I’m assuming that FastAI doesn’t automatically sort the points in any particular order.
So basically I was wondering if there is a way to access the points and I can adjust them with my own code. If it helps this is the code that I use to read in the images/ points:
def get_coords(fname):
fname = fname.split('/')[-1]
coords = torch.FloatTensor(df.loc[df.image==fname,'coords'].values[0]).reshape(-1,2)
return coords[:, [1,0]]
src = PointsItemList.from_df(df, cols='image', path=PATH, folder='Data_Training')
data = (src
.random_split_by_pct()
.label_from_func(get_coords)
.transform(get_transforms(), tfm_y=True, remove_out=False, size=(120,160))
.databunch().normalize(imagenet_stats)
)
Assume that I already have a function def sort_points(points)
, which takes in a set of points and sorts them for one image.