Mediapipe holistic model detection - python-3.x

AttributeError: module 'mediapipe.python.solutions.holistic' has no attribute 'LEFT_HAND_LANDMARKS'
I am trying to use left hand landmarks in mediapipe holistic model but it gives error that it has no attribute of LEFT_HAND_LANDMARKS
I were expecting to get 21 landmarks of hand defined in mediapipe solution.

Related

Module for Yolo V5

Is yolov5 is contained in the module torchvision.model? I have been getting an attribute error when trying to call yolo in pytorch.
AttributeError: module 'torchvision.models' has no attribute 'yolov5'

keras tuner AttributeError: module 'tensorflow._api.v1.keras.metrics' has no attribute 'Metric'

When I use keras Tuner for tuning, tuner=RandomSearch(hypermodel=model,objective='mse',seed=42,max_trials=3,directory=r'E:\multivariate test\bayes',project_name=' helloworld') reported an AttributeError: module'tensorflow._api.v1.keras.metrics' has no attribute'Metric', error,how to solve this problem?
Maybe you are using TF v < 2.2. You can check this page [https://www.tensorflow.org/api_docs/python/tf/keras/metrics/Metric]. There you can find this: tf.keras.metrics.Metric

GluonCV, action recognition tutorial error

I've been trying to run the GluonCV tutorial for action recognition.
I didn't modify anything, but I'm getting an error at the very beginning of the script, when applying the transformation function to the image.
The error is:
AttributeError: 'list' object has no attribute 'shape'
To try and solve it, I wanted to replace the list with a single image, so I tried:
img = transform_fn(img.asnumpy())
plt.imshow(np.transpose(img, (1,2,0)))
plt.show()
but in this case, I get another error:
TypeError: Image data of dtype object cannot be converted to float
Any idea on how to fix it?
Thanks!
It seems I had to update gluoncv to a later version.
A little weird, because I installed it following the instruction on the tutorial page, but it works after the update.

Error - 'English' object has no attribute 'add_label'

I have trained on spacy's blank model with 5 entities and now I have made a new data with 2 new entities. On training on top of old model with 5 entities,
nlp.add_label(LABEL)
gives error:
AttributeError: 'English' object has no attribute 'add_label'
Spacy version : 2.1.4
Python : 3.6
You have to use add_label on the pipeline component (e.g. ner or textcat) - not on the nlp object. It's probably useful to read through the documentation in a bit more detail here.

Tflearns .fit() method with numpy.ndarrays causing TypeError

So I get this error TypeError: unhashable type: 'numpy.ndarray' when executing the code below. I searched through Stackoverflow but haven't found a way to fix my problem. The goal is to classify digits via the mnist dataset. The error is in the modell.fit() method (from tflearn). I can attach the full error message of the error if needed. I tried it also with the method were you put the x and y lables in an dictionary and train it with this but it raised another error message. (Note I excluded my predict function in this code).
Code:
import tflearn.datasets.mnist as mnist
x,y,X,Y=mnist.load_data(one_hot=True)
x=x.reshape([-1,28,28,1])
X=X.reshape([-1,28,28,1])
import tflearn
class Neural_Network():
def __init__(self,x,y):
self.x=x
self.y=y
self.epochs=60000
def main(self):
cnn=tflearn.layers.core.input_data(shape=[None,28,28,1],name="input_layer")
cnn=tflearn.layers.conv.conv_2d(cnn,32,2, activation="relu")
cnn=tflearn.layers.conv.max_pool_2d(cnn,2)
cnn=tflearn.layers.conv.conv_2d(cnn,32,2, activation="relu")
cnn=tflearn.layers.conv.max_pool_2d(cnn,2)
cnn=tflearn.layers.core.flatten(cnn)
cnn=tflearn.layers.core.fully_connected(cnn,1000,activation="relu")
cnn=tflearn.layers.core.dropout(cnn,0.85)
cnn=tflearn.layers.core.fully_connected(cnn,10,activation="softmax")
cnn=tflearn.layers.estimator.regression(cnn,learning_rate=0.001)
modell=tflearn.DNN(cnn)
modell.fit(self.x,self.y)
modell.save("mnist.modell")
nn=Neural_Network(x,y)
nn.main()
nn.predict(X[1])
print("Label for prediction:",Y[1])
So the problem fixed it self. I only restarted my Jupiter-Notebook and everything worked fine. But with a few execptions: 1. I have to restart the Kernel everytime I want to retrain the net, 2. I get another error while I try to load the saved modell, so I can't work on (the error is NotFoundError: Key Conv2D_2/W not found in checkpoint). I will ask another question for this problem. Conclusion: Try to relod your Jupiter Notebook if something is't working well. And if you are want to train a ANN restart your Kernel.

Resources