Edges creation is not working in gremlin python - cosmos

Trying to create edges between vertices using gremlin-python, but it is not working
jupyter notebook
"g.V('ProdDev').addE('belongs').to(g.V('Dept'))"
edges should create....currently empty edges are creating...

When you use
g.addV('Season')
that creates a vertex with the label Season.
However, when you use
g.V('Season')
Gremlin is looking for a vertex with an ID (not a label) of Season.
If you need to use the label you can do
g.V().hasLabel('Season')
Also, mid traversal, you should not use g.V() rather you should do
to(V().hasLabel('Season'))

Related

How Can I Convert Dataset Annaotations To Fixed(YoloV5) Format Without Hand Encoding

So I Am Working On This Awesome Project On Object Detection,Where The Prior Task Is To Identify Brand Logos, So after Doing some research i found this dateset available for the
brand logo For More About Dataset:here
DATASET:
This dateset has 2 versions
FlickrLogos32
FlickrLogos47(recommended for brand detection)
as the name 32 and 47 are the no. of classes offered by this dataset. From the Documentation itself mentioned 47 version is correctly annotated and recommended for object detection & recognization also in my project i have used 47 version
Model:
I Am Using YoloV5 For object detection the
reason behind using YoloV5 and not previous versions is, it it well documented with couple of tutorials with jupyter notebooks available
Problem:
As For The YoloV5:Object Detection Model,The Object Label Should Be Annotated As
<x_center> <y_center> <width> <height> corresponds to bounding box(below image),
whereas the dataset annotations are given in the form of
<x1> <y1> <x2> <y2> where <x1>,<y1>:upper left corner of the bounding box
<x2>,<y2>:lower right corner of the bounding box.
How can i transform <x1>,<y1>,<x2>,<y2>: corner points of bounding box to naive yolo
annotations format i.e.<center_x>,<center_y>,<height>,<width>
without manually going one by one over image and drawing rectangle box with roboflow
Also the Labels are annotated by pixel so we have to normalize it in (0,1)
Datset Insights:
For Any Dataset Example Its Having An Image(.png) and as a Label A Ground truth(.txt)(see below image)
the '.mask' file its just binary mask of object present in image
So A Data Example look likes:
Image:
gt_data.txt:
Mask:
In general to calculate the center it should be xmin + (width/2) and ymin + (height/2). So I think you have you /2 in wrong part of the equation.
Also note that an yolo annotation will look like this.
0.642859 0.079219 0.148063 0.148062
The coordinates are relative to the size of the photo from 0-1. To normalize the coordinates you need to normalize the x dimensions by dividing by the photo width and normalize the y dimensions by dividing by the photo height.

Is there a way to move the x when hovering on mxgraph vertext?

As you can see there is a x when I'm hovring on mxgraph vertex. I need to remove it. Is there a way to do this?
Looks like you are using the grapheditor example.
If you want to remove them all, you have to exclude the Constraints from the Shape.js
GraphEditor - Shape.js
If you want to exclude them only from the cylinder, you need to check from which class your shape is derived from and then exclude only those constraints.

Can LibGDX do relative rendering when a sprite is a child of another?

With frameworks such as Cocos2d and SpriteKit, it is possible to add a sprite/label/node as a child of another. If a node is rotated, then the rendering of its children will be affected by such rotation and so on throughout the node tree.
Can this be achieved in LibGDX?
Yes this can be achieved using Scene2d.
Wiki Entry:
Rotation and scale of a group is applied to all child actors. Child actors always work in their own coordinate system, parent transformations are applied transparently.
What you are looking for is a scene Graph and this is provided as mentioned in the Scene2d api. What you do is, you create a group, add your sprite, e.g. a tank, add a label and other stuff. Then you can rotate the group and all children will be rotated with it. If you want just rotate the tank this is still possible but in most cases you just transform the root node, a Group.
The sprite itself is leave and if you won't to transform some sprites together you just put them in the same group and apply the transform their.
If you wanna create several 100 Sprites with a label together you could do this: Implement a RefNode which references a Group. Create a group where you add a sprite and a label. (if you wanna change the label text you would have to store it separately and update it before you actually render the referenced group) Then you can apply all the transformation to the RefNode.

Object does not rotate around pivot point

I have an object which looks like this:
When I try to rotate it using [INSTANCENAME].rotation += 10;
it still rotates around the middle of the object. Am I doing something wrong?
I've done a little research, and apparently there is no direct way to change the pivot point programmatically, AFAIK. Rather odd, seeing as you can change it in the Flash Pro IDE. (For those reading, the pivot point is NOT the same as the registration point.)
[EDIT: Thinking more about it, I don't think the pivot point actually "exists", at least in the context of a programmable property. It only exists in the context of some tools in the Flash IDE.]
You will need to place your object ALONE inside another object, so that the desired pivot point of the inner object is over the center of the outer object. Then, rotate the outer object.
You can later control your object's "pivot point" by changing the position of the inner object.
Since the outer object's center moves depending on its size, and the position of the inner object determines the size of the outer object, you'd need to apply some math. The x position of the inner object would need to be equal to the distance from the desired pivot point on the inner object to the far right edge of that inner object. The same concept applies to the y position.
This can be accomplished both in the IDE directly, or through code, whichever you choose.
An example of code to change this dynamically. This function is inside the outer object. (You can get pivotX and pivotY off an event listener, if you want.) [Sorry, the code is untested.]
function newPivot(int pivotX, int pivotY):void
{
inner.x = inner.width - pivotX;
inner.y = inner.height - pivotY;
}
I hope that solves your problem!
A very simple way is to do like this.
Convert the image to a symbol(MovieClip). [you might have already done it].
Double Click on the MovieClip/Sprite to enter inside.
Move the Image so that the registration point align towards the pivot.
NB: Applicable only in case of FLASH IDE.

Is it possible to layout this HTML table + customized dendrogram using MATLAB's publish command?

I would like to put together a more publication-worthy (and more easily produced) version of the diagram that I've hacked together below:
Basically, it's a two part illustration with an HTML table on the left (showing different cluster assignments from varying parameters) and a modified dengrogram plot on the right.
I'm guessing it's apparent from the snapshot what I'm trying to add to the plot… Basically it could be a set of horizontal, stacked bars that show how the different parameters grouped the observations into different clusters. I used brackets with the cluster numbers when drawing these by hand, but anything that underlines the right observation numbers would be acceptable.
I realize there are two parts to this question: How to get the two-up layout when one of the panels is HTML instead of a figure, and how to modify the plot. [If only one part gets answered here, I can ask for the other in a separate question.]
You can label your plot using line and text. You need to set the clipping property to off in order for lines to show up outside of your axes. Here's an example:
data = [1,3,4,5; 2,6,7,8; 9,3,7,4;3,8,5,2];
tree = linkage(data,'average');
figure()
dendrogram(tree)
set(gca,'Position',[0.13, 0.3,0.775, 0.65])
h1 = line([1,1],[4,4.8],'Color','k');
h2 = line([1,3],[4,4],'Color','k');
h3 = line([3,3],[4,4.8],'Color','k');
set(h1,'Clipping','off')
set(h2,'Clipping','off')
set(h3,'Clipping','off')
ht = text(1.7,3.9,'Label');