It works well with only attach left or right tree. But when it comes to attach sub tree it turns out not successfully added. Here is the code: class BinaryTree(): class BinaryTreeNode(): def __init__(self,leftchildnode,rightchildnode,item): self.leftchildnode = leftchildnode self.rightchildnode = rightchildnode self.item = item def __init__(self): self.root = None def setRoot(self,item): self.cur = self.BinaryTreeNode(None,None,item) self.root = ..

Read more

I have built a model using custom image generator and custom loss function in tensorflow2. The batch_size is 62 and y_pred is a 15 dimensional vector. I have checked the output of the generator function and Its working fine. Further, I checked loss function def loss_func(y_true, y_pred): print(‘ny_pred_shape’, y_pred.shape) print(‘y_pred’,y_pred) print(‘y_true_shape’, y_true.shape) print(‘y_true’,y_true) loc_loss = ..

Read more

I trying ImageAI with Python by Tutorial. Tutorial recorded in 2019. Now this code not working. Code: from imageai.Detection import ObjectDetection import os import tensorflow.compat.v1 as tf tf.disable_v2_behavior() exec_path = os.getcwd() detector = ObjectDetection() detector.setModelTypeAsRetinaNet() detector.setModelPath(os.path.join( exec_path, "resnet.h5") ) detector.loadModel() list = detector.detectObjectsFromImage( input_image=os.path.join(exec_path, "objects.jpg"), output_image_path=os.path.join(exec_path, "new_objects.jpg"), minimum_percentage_probability=90, display_percentage_probability=True, display_object_name=False ) Output from Run(PyCharm): AttributeError: ..

Read more

I´am really new to programming with Pyqt and python. I have just set up a basic main window: class Ui(QtWidgets.QMainWindow): def __init__(self): super(Ui, self).__init__() uic.loadUi(‘mainwindow.ui’, self) self.show() self.setWindowTitle(‘escape room game’) self.button = self.findChild(QtWidgets.QPushButton, ‘start’) self.button.clicked.connect(self.startPressed) self.button = self.findChild(QtWidgets.QPushButton, ‘examine’) self.button.clicked.connect(self.examinePressed) self.button = self.findChild(QtWidgets.QPushButton, ‘explore’) self.button.clicked.connect(self.explorePressed) self.button = self.findChild(QtWidgets.QPushButton, ‘doit’) self.button.clicked.connect(self.doitPressed) self.input = self.findChild(QtWidgets.QLineEdit, ‘input’) self.examine_label.setText("hello ..

Read more

Here is prefix notation – 96^2 Here is my code adjust from postfix version code all down below is about making tree and print prefix postfix and infix class Node: def __init__(self, ch=None): self.ch = ch self.left = None self.right = None class Tree: def __init__(self): self.root = None def postfixTraversal(cur): if cur.left is not ..

Read more

I’m trying to get my bot to play music and I got him to connect to the voice channel but when It tries to play the music it’s giving the error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name ‘voice_Client’ is not defined Does anyone have a fix? My code: import discord from discord.ext import commands ..

Read more

I’m using python version 3.8.6 and pytube vesion 9.6.0 This is the basic code I wrote for getting started in making a youtube video downloader. from pytube import YouTube yt = YouTube("https://www.youtube.com/watch?v=UtF6Jej8yb4") yt.streams.all() After running this I check the output window then a facing these issues I mentioned below… PS C:UsersOwnerDesktopcd> & C:/Users/Owner/AppData/Local/Programs/Python/Python38/python.exe c:/Users/Owner/Desktop/cd/youtubedl.py Traceback ..

Read more