Categories
Artificial Intelligence (AI) Mastering Development

How do I modify the activation functions from keras?

I would like to use the activation function relu with its parameter alpha set to 0.2, but I could not figure out how this can be done for my model import numpy from tensorflow.keras.layers import Dense, Activation, Dropout, Input from tensorflow.keras.models import Sequential, Model, load_model from tensorflow.keras.optimizers import Adam model_input = Input(shape = x_train[0].shape) x […]

Categories
Development

keras squeezenet ImportError: cannot import name ‘warnings’

File “C:\Users\user16\AppData\Local\Programs\Python\Python35\lib\site-packages\keras_squeezenet\squeezenet.py”, line 3, in from keras.layers import Input, Convolution2D, MaxPooling2D, Activation, concatenate, Dropout, warnings ImportError: cannot import name ‘warnings’

Categories
Development Linux Ubuntu

update-initramfs stuck after upgrade because of LVM

After upgrading Ubuntu trusty (i386) to xenial (but BEFORE reboot), the update-initramfs operation hangs because of LVM : $ sudo apt install E: dpkg was interrupted, you must manually run ‘sudo dpkg –configure -a’ to correct the problem. $ sudo dpkg –configure -a Setting up linux-image-4.4.0-171-generic (4.4.0-171.200) … I: /initrd.img is now a symlink to […]

Categories
Artificial Intelligence (AI) Development

How can policy gradient fulfill the required action range?

As we often use the gaussian policy for continuous action space, but how can we make it proper for the range. In spiningup’s implementation, I found they just simply used, def mlp_gaussian_policy(x, a, hidden_sizes, activation, output_activation, action_space): act_dim = a.shape.as_list()[-1] mu = mlp(x, list(hidden_sizes)+[act_dim], activation, output_activation) log_std = tf.get_variable(name=’log_std’, initializer=-0.5*np.ones(act_dim, dtype=np.float32)) std = tf.exp(log_std) pi […]

Categories
Development

How to resolve “module ‘tensorflow’ has no attribute ‘get_default_graph'”

I am trying to build a deep learning model but I am getting an error using tensorflow and I am failing to fix this issue. The error is: module ‘tensorflow’ has no attribute ‘get_default_graph’ Code: import csv import cv2 import os import numpy as np import numpy as ndarray import tensorflow as tf import pandas […]

Categories
Development

How to display Active Storage attached file when editing form?

I am building an Agreement management app. Each Agreement has vendor, activation, expiration dates and file. File is an attached agreement in pdf. I use Active Storage for attaching files. When I edit the form I don’t see the attached file. As a consequence if I change any other parameter let’s say vendor and update […]

Categories
Development

implement a CNN model using Tensorlow 2.0

I am facing a lot of errors in my project as I am new to this field. Please help me out with these issues. **Please see the code below** Thanks in advance Kind Regards, Mazhar Bukhari Assignment No. 2 Due Date: 20/10/2019 In this assignment you have to implement a CNN model using Tensorlow 2.0. […]

Categories
Artificial Intelligence (AI) Development

Semantic issues with predictions made by my trained model

I’m new to Deep Learning. I used Keras and trained a inception_resnet_v2 model for my binary classification application (fire detection). As suggested from my previous question of a non-X class, I prepared a dataset of 8000 images of fire, and a larger dataset for non-fire (20,000 random images) to make sure the network also sees […]

Categories
Development

getting verbal noun from noun

A verbal noun is a noun formed from or otherwise corresponding to a verb. I am looking to write an algorithm which when given a noun returns the corresponding verb (if the input noun is a verbal noun). My initial thought was to apply a stemmer to the noun, then search a verb list for […]

Categories
Development

TF2.0 Invalidargumenterror Inputs to operation AddN of type AddN must have the same size and shape. Input 0: [4,1] != input 1: [] [Op:AddN]

I am new to tensorflow 2.0. I am trying to build a neural network with some additional theoretical information. Basically, the idea is to combine multiple neural networks and in between add some theoretical information. In the below code snippet, I replicated the error with boston housing dataset. I am getting an error while computing […]