TensorFlow Object Detection API CSV file format - csv

Im new to using TensorFlows object detection API but understand I need to convert a csv file to a TFRecord. I understand the format of the csv should be 8 columns, as follows:
filename, width, height, class, min, xmax, ymin, ymax
what im confused about is which corner of the image is assumed to be the origin?
Thanks for any help!

The top left corner of the image is assumed to be the origin (0,0), with the width (x coordinates) increasing as you move to the right and the height (y coordinates) increasing as you move downwards.
So basically, the bottom-right corner of the image would be indexed as (width-1,height-1)
The format that you described above is basically the Pascal VOC annotation format in which, for a particular bounding box
xmin denotes the x coordinate of the top left corner
ymin denotes the y coordinate of the top left corner
xmax denotes the x coordinate of the bottom right corner
ymax denotes the y coordinate of the bottom right corner

Related

Why is the y axis inverted in the HTML DOM and in SVG?

The y axis instead of going upwards, goes downwards, whilst the x axis has the normal sense from left to right. Why?
It is one of the most annoying obstacles when doing the graphic part of a website because the geometry has to be recalculated, as the usual calculation as in the cartesian plane will be wrong. So, why does this happen? Is there a specific reason? Did they not notice that they were betraying traditional mathematics?

How to pan openseadragon mutli image viewer within the bounds

I have a multi image openseadragon viewer, where the coordinates of each tiled image seem to be calculated based on the size of the image to the container viewer size. When the user clicks on a specific image I am trying to fit the image to the center of the viewport by using fitBounds method. Here I am passing the bound rect of the image the user has clicked. This is working perfectly. Now I have a requirement where say a panel is placed on the right side, on top of the viewer, I need to consider the boundary till the left of the panel(Viewer area includes the area under the right side panel). What this means is that, though the viwer need to occupy full width, the image that need to be fit should concider only the center between the left of the viewer upto left of the panel(excludes the area under the panel). I tried doing PanTo but couldn't understand how to calculate the center for a multi image scenario.It doesn't seem to be accurate. The x coordinate of the 4th image seem to be at 4.9 and am trying to see how I can calculate a correct coordinate center for each image where I can panTo. Can someone point me in the right direction?

Get a square region of earth

I have a certain region given by the coordinates of the lefttop corner and bottom right corner. However, the region formed is not square since the radius of the circle decreases as the latitude increases. In my case, there is a difference of 3-4 km when I calculate the distance using top two coordinates and the bottom two coordinates So, how can I get a square region. I can't suppose that the the region bounded by the lefttop corner coordinate and bottomright coordinate is square. I want a region where the top two corners have a distance of x miles and the bottom two corners have a distance of x miles. Suggestions?
If you aren't into super-accuracy (ie the words WGS84 and oblate spheroid mean nothing to you) then it's simply a matter of calculating the km/degree of longitude at the upper latitude and then shifting the longitude of the two corners out a little, one east and one west.
Roughly:
Latitude: 1 deg = 110.54 km
Longitude: 1 deg = 111.320*cos(latitude) km
http://en.wikipedia.org/wiki/Latitude
Being precise, you cannot have square region on sphere surface. If you correct the distance of top 2 coordinates, then the "right" angles will not be 90 degrees and who knows if the vertical sides would be straight lines!
Google maps projection naturally gives you square in [lat, lon] 2D space, which is correct for most purposes - I also use this geographical "rectangle" grid of 11x11km squares on small spatial scales (400x200km) with no problems. If you neglect the small difference, your life will be much much easier. If you don't, I really cannot assure you the problem of exact rectangle on sphere surface even has any solution!

Align the coordinate labels of the triangles, so that they never collide with each other. Actionscript 3

Im trying to achieve something similar to the flash movie in the below link.
http://mathopenref.com/coordtrianglearea.html
As we drag the points of the triangle, the coordinates labels, ( A(1,2)) are properly aligned and arrange themselves so that they never collide with each other and never falls inside the triangle.
Please guide me..
Thanks in advance.
in the example you gave, the textfield seems to be aligned outside the triangle on the angle bisection of the corresponding corner.
for the position in one corner, take the two vectors to the other corners. normalize them and then add them and normalize the resulting vector again. this gives you the vector v of the angle bisection in that corner. multiply the vector with a negative constant and add it to the corner, and you'll obtain a position p outside the triangle. finally, if the angle of v is between pi/2 and -pi/2 (pointing right) align the right border of the label to p, and the left border otherwise.
for simple vector calculations, please see flash.geom.Point.

How to prevent external translation of a movieclip object on stage in AS3?

I have a MovieClip object, which is exported for actionscript (AS3) in an .swc file.
When I place an instance of the clip on the stage without any modifications, it appears in the upper left corner, about half off stage (i.e. only the lower right quadrant of the object is visible). I understand that this is because the clip has a registration point which is not the upper left corner.
If you call getBounds() on the movieclip you can get the bounds of the clip (presumably from the "point" that it's aligned on) which looks something like (left: -303, top: -100, right: 303, bottom: 100), you can subtract the left and top values from the clip x and y:
clip.x -= bounds.left;
clip.y -= bounds.top;
This seems to properly align the clip fully on stage with the top left of the clip squarely in the corner of the stage.
But! Following that logic doesn't seem to work when aligning it on the center of the stage!
clip.x = (stage.stageWidth / 2);
etc...
This creates the crazy parallel universe where the clip is now down in the lower right corner of the stage.
The only clue I have is that looking at:
clip.transform.matrix
and
clip.transform.concatenatedMatrix
matrix has a tx value of 748 (half of stage height) ty value of 426 (Half of stage height)
concatenatedMatrix has a tx value of 1699.5 and ty value of 967.75
That's also obviously where the movieclip is getting positioned, but why? Where is this additional translation coming from?
I believe that I have solved the problem.
It seems that when the stage is not set to specific dimensions, the scale of the items (or this particular vector object in my case) on the stage is relative to some preset scale/dimensions (The origin of which I'm not sure -- with some testing it looks like it is affected by the ratio and dimensions of the stage).
Increasing the size of the stage increases that scaling value, which through some set of concatenations of matrices results in the movieclip getting scaled and translated at that same percentage (as the stage), even if you explicitly set the x/y/width/height values.
(Note: not just resizing dynamically. Resizing the window, closing and re-opening the window at that new size produces the same behavior)
I suspect this only happens with vector objects?
Anyway, the fix is to set the stage to an explicit width and height. Then the translation and scaling of the object appear to use an identity parent matrix, and everything works like you'd expect.