1

python enter image description here

                     coords                                      score
[1018, 370, 1345, 370, 1345, 699, 1018, 699, 1018, 370]         0.9988
[1344, 366, 1669, 366, 1669, 690, 1344, 690, 1344, 366]         0.9985
[1341, 688, 1669, 688, 1669, 1012, 1341, 1012, 1341, 688]       0.9985
[2643, 49, 2972, 49, 2972, 362, 2643, 362, 2643, 49]            0.9984
[1018, 1020, 1341, 1020, 1341, 1342, 1018, 1342, 1018, 1020]    0.9984
[2321, 371, 2651, 371, 2651, 696, 2321, 696, 2321, 371]         0.9984
[2970, 1018, 3296, 1018, 3296, 1345, 2970, 1345, 2970, 1018]    0.9984
[1016, 696, 1342, 696, 1342, 1011, 1016, 1011, 1016, 696]       0.9984
[697, 371, 1020, 371, 1020, 693, 697, 693, 697, 371]            0.9984
[1341, 1017, 1668, 1017, 1668, 1348, 1341, 1348, 1341, 1017]    0.9984
[2975, 366, 3300, 366, 3300, 686, 2975, 686, 2975, 366]         0.9984
[2319, 701, 2645, 701, 2645, 1017, 2319, 1017, 2319, 701]       0.9984
[2976, 51, 3298, 51, 3298, 363, 2976, 363, 2976, 51]            0.9984
[2645, 1349, 2971, 1349, 2971, 1665, 2645, 1665, 2645, 1349]    0.9983
[2972, 1659, 3295, 1659, 3295, 1991, 2972, 1991, 2972, 1659]    0.9983
[1013, 1343, 1343, 1343, 1343, 1671, 1013, 1671, 1013, 1343]    0.9983
[3298, 47, 3619, 47, 3619, 359, 3298, 359, 3298, 47]            0.9983
[1676, 367, 1999, 367, 1999, 690, 1676, 690, 1676, 367]         0.9983
[2323, 50, 2644, 50, 2644, 366, 2323, 366, 2323, 50]            0.9983
[2000, 371, 2326, 371, 2326, 691, 2000, 691, 2000, 371]         0.9983
[2650, 372, 2971, 372, 2971, 690, 2650, 690, 2650, 372]         0.9983
[2972, 1348, 3298, 1348, 3298, 1664, 2972, 1664, 2972, 1348]    0.9982
[1019, 1671, 1344, 1671, 1344, 1986, 1019, 1986, 1019, 1671]    0.9982
[2648, 1021, 2971, 1021, 2971, 1340, 2648, 1340, 2648, 1021]    0.9982
[695, 690, 1017, 690, 1017, 1015, 695, 1015, 695, 690]          0.9982
[1998, 52, 2323, 52, 2323, 365, 1998, 365, 1998, 52]            0.9982
[1021, 49, 1342, 49, 1342, 361, 1021, 361, 1021, 49]            0.9982
[2317, 1344, 2645, 1344, 2645, 1666, 2317, 1666, 2317, 1344]    0.9982
[1343, 1670, 1667, 1670, 1667, 1988, 1343, 1988, 1343, 1670]    0.9982
[692, 47, 1019, 47, 1019, 364, 692, 364, 692, 47]               0.9982
[370, 370, 695, 370, 695, 695, 370, 695, 370, 370]              0.9981
[1344, 1347, 1674, 1347, 1674, 1673, 1344, 1673, 1344, 1347]    0.9981
[1670, 53, 1992, 53, 1992, 369, 1670, 369, 1670, 53]            0.9981
[1345, 51, 1667, 51, 1667, 365, 1345, 365, 1345, 51]            0.9981
[3301, 364, 3623, 364, 3623, 692, 3301, 692, 3301, 364]         0.9981
[2646, 692, 2973, 692, 2973, 1014, 2646, 1014, 2646, 692]       0.9981
[1672, 689, 1995, 689, 1995, 1015, 1672, 1015, 1672, 689]       0.9981
[374, 696, 695, 696, 695, 1017, 374, 1017, 374, 696]            0.9980
[1994, 695, 2323, 695, 2323, 1022, 1994, 1022, 1994, 695]       0.9980
[2321, 1667, 2645, 1667, 2645, 1993, 2321, 1993, 2321, 1667]    0.9980
[3300, 694, 3619, 694, 3619, 1016, 3300, 1016, 3300, 694]       0.9980
[372, 1021, 694, 1021, 694, 1337, 372, 1337, 372, 1021]         0.9980
[370, 1671, 691, 1671, 691, 1991, 370, 1991, 370, 1671]         0.9979
[2641, 1671, 2971, 1671, 2971, 1985, 2641, 1985, 2641, 1671]    0.9979
[2315, 1017, 2644, 1017, 2644, 1343, 2315, 1343, 2315, 1017]    0.9979
[694, 1022, 1016, 1022, 1016, 1339, 694, 1339, 694, 1022]       0.9979
[2000, 1672, 2322, 1672, 2322, 1994, 2000, 1994, 2000, 1672]    0.9978
[367, 50, 690, 50, 690, 365, 367, 365, 367, 50]                 0.9978
[371, 1339, 692, 1339, 692, 1671, 371, 1671, 371, 1339]         0.9978
[691, 1341, 1016, 1341, 1016, 1668, 691, 1668, 691, 1341]       0.9977
[1996, 1350, 2319, 1350, 2319, 1675, 1996, 1675, 1996, 1350]    0.9977
[1673, 1020, 1996, 1020, 1996, 1348, 1673, 1348, 1673, 1020]    0.9976
[692, 1670, 1019, 1670, 1019, 1989, 692, 1989, 692, 1670]       0.9976
[2000, 1023, 2322, 1023, 2322, 1349, 2000, 1349, 2000, 1023]    0.9976
[1675, 1347, 1995, 1347, 1995, 1671, 1675, 1671, 1675, 1347]    0.9975
[3295, 1344, 3618, 1344, 3618, 1673, 3295, 1673, 3295, 1344]    0.9975
[1673, 1671, 1992, 1671, 1992, 1989, 1673, 1989, 1673, 1671]    0.9975
[3297, 1017, 3617, 1017, 3617, 1340, 3297, 1340, 3297, 1017]    0.9974
[3300, 1673, 3622, 1673, 3622, 1990, 3300, 1990, 3300, 1673]    0.9973
[3620, 51, 3940, 51, 3940, 361, 3620, 361, 3620, 51]            0.9972   
[3625, 368, 3947, 368, 3947, 689, 3625, 689, 3625, 368]         0.9969
[3622, 699, 3944, 699, 3944, 1013, 3622, 1013, 3622, 699]       0.9969
[43, 697, 371, 697, 371, 1011, 43, 1011, 43, 697]               0.9967
[43, 1021, 372, 1021, 372, 1342, 43, 1342, 43, 1021]            0.9966
[3622, 1667, 3942, 1667, 3942, 1990, 3622, 1990, 3622, 1667]    0.9961
[3619, 1021, 3938, 1021, 3938, 1339, 3619, 1339, 3619, 1021]    0.9960
[45, 378, 372, 378, 372, 689, 45, 689, 45, 378]                 0.9959
[3623, 1348, 3946, 1348, 3946, 1671, 3623, 1671, 3623, 1348]    0.9958
[46, 1667, 372, 1667, 372, 1989, 46, 1989, 46, 1667]            0.9957
[41, 1351, 367, 1351, 367, 1671, 41, 1671, 41, 1351]            0.9957
[43, 49, 370, 49, 370, 362, 43, 362, 43, 49]                    0.9957
[2972, 695, 3299, 695, 3299, 1011, 2972, 1011, 2972, 695]       0.9638 

Here is the DataFrame that I have. There are 72 rows x 2 columns. (The above DataFrame is the snippet of the DataFrame. If you count the number of cells in this Electroluminescence (EL) image of a solar module you'll note that it has 72 photovoltaic cells.

Column 'coords' has the co-ordinates of the each polygon segment in the image.

Column 'score' is the accuracy score of the tile ( whether placed in the desired position ) corresponding to the co ordinates. The score is not important but is an output of the model.

Let me explain where these polycoordinate segmentations are coming from...

I have designed an image segmentation model which outputs the coordinate arrays above but I have been asked to tag each segmented cell with a an (x,y) identity.

The image segmentation model has no concept of location so the initial result set is sorted by the probability that a cell has been correctly identified.

Now consider the top left tile as (0,0), Move to the right one cell and that will be tagged as (0,1). Move down 1 cell from there and you would tag that cell (1,1) etc...

Basically: How can I process these poly coordinates and end up with the (x,y) identity of each cell?

  • 2
    What is your question? Stack overflow is not a place to get people to write code for you. Consider showing what you have tried so far and where you are stuck. – NewPythonUser May 30 '20 at 09:22
  • I am looking for a strategy to tackle this problem. – Arnav Somani May 30 '20 at 09:46
  • 1
    If I understand your coordinates correctly they are the 4 corners of the squares in 5 (x,y) pairs, where the first pair and last are the starting corner. Perhaps you could find the center for each square (c_x, c_y), sort the center points first by x-axis, then y-axis. You would end up with a list of 72 points where every 12 elements are new rows. That is if you were to iterate over the list then for every 12 elements in the list you increment the y and reset the x coordinate. – NewPythonUser May 30 '20 at 10:11
  • 1
    For how to sort coordinates you could take a look here for instance: https://stackoverflow.com/questions/37111798/how-to-sort-a-list-of-x-y-coordinates – NewPythonUser May 30 '20 at 10:17
  • Hey NewPythonUser, I like that strategy but based on what this image is: a solar cell. There are likely different configurations if a different type of solar cell was run through the model so this sorting algorithm may not have the luxury of knowing that the number of elements in a row is 12. – Clark Cody Maine May 30 '20 at 10:35
  • In that regard you could just cluster the points by y-axis to find the number of points per row – NewPythonUser May 30 '20 at 10:58

0 Answers0