Skip to main content

Posts

Mask R-CNN is not loading weights properly for inference and re-training

QUESTION: I'm new to the world of computer vision and this is my second project with it. I am running an edited version of the Matterport Mask RCNN that runs with tensorflow-gpu==2.7.0. (Found out later it would have worked out just fine with an older version) I am trying to use this with a pen data set I created. Anyway, the problem I am having is whenever I load the trained weights into the model to resume training it, the metrics all skyrocket back up. I am also getting bad predictions loading them for inference as well. Why are my weights not loading or saving properly? I am saving the weights using callbacks and loading them using the following: model = modellib.MaskRCNN(mode="inference", config=inference_config, model_dir=MODEL_DIR) # Get path to saved weights model_path = model.find_last() # Load trained weights print("Loading weights from ", model_path) model.load_weights(model_path, by_name=True)

Adding losses in Keras

I'm trying to find a way to accumulate losses in Keras. This works (for Gaussian-Mixture-Model loss = negative log likelihood) but is not so elegant: def neg_log_likelihood(y, phis, mu, sigmasq): a = phis[:, 0]*gaussian_pdf(y, mu[:, 0*t:(0+1)*t], sigmasq[:, 0]) for i in range(1, k): a += phis[:, i]*gaussian_pdf(y, mu[:, i*t:(i+1)*t], sigmasq[:, i]) loss = tf.math.reduce_mean(-tf.math.log(a)) return loss I would rather create a new variable for the losses, and accumulate everything there. E.g., I tried: def neg_log_likelihood(y, phis, mu, sigmasq): losses = tf.Variable(np.zeros(n, dtype=np.float32)) for i in range(k): losses.assign_add(phis[:, i]*gaussian_pdf(y, mu[:, i*t:(i+1)*t], sigmasq[:, i])) loss = tf.math.reduce_mean(-tf.math.log(losses)) return loss but this fails to produce gradients for some reason. I.e., when I call: gradients_init = tape.gradient(loss, model.trainable_weights) I get None . Anyway to overcome this?

Convert all alpha characters of string to integers in separate columns within a pandas dataframe

I have a single column of strings that contain alpha numeric characters as follows: AA128A AA128B AA128C AA128D AA128E AA129A AA129B AA129C CP100-10 CP100-11 CP100-12 CP100-13 CORSTG11A CORSTG11B CORSTG11C I'm wanting to explode each individual character into separate columns and convert all alpha characters into their ASCII decimal value and retain the numeric values as they are. If the value is null after exploding the values, I want to replace it with -1. I have been able to explode the values and replace nulls, however when I attempt to iterate over the values with the ord() function to convert the alpha characters, I get the error: ord() expected string of length 1, but int found Even if I create conditional analysis on the datatype within a for loop. import numpy as np import pandas as pd from sklearn.preprocessing import OrdinalEncoder from pandas.api.types import is_string_dtype from pandas.api.types import is_numeric_dtype loc_df = pd.read_csv('C:

My chromedriver looks like text file on Mac

Here is my code from datetime import time from selenium import webdriver driver = webdriver.Chrome("../drivers/chromedriver") # driver = webdriver.Firefox("../drivers/geckodriver") driver.set_page_load_timeout(10) driver.get("https://www.google.se") driver.find_element_by_id("L2AGLb").click() driver.find_element_by_name("q").send_keys("Automation step by step") driver.find_element_by_name("btnK").click() time.sleep(2) driver.close() driver.quit() print("Test Completed") This code opens the firfox. Click on accept cookies button, then search for the text and even the search text appears. But the following part of code doesn't work and I get the error DeprecationWarning: executable_path has been deprecated, please pass in a Service object driver = webdriver.Chrome("../drivers/chromedriver") time.sleep(2) driver.close() driver.quit() print("Test Completed") source

Problem To Get Order Price On Binance Futures Api

I can place an order on Binance futures api, using NewOrder, but I do not have the price in return in the datas. I get. {'exchange': 'binance_futures', 'pair': 'MANAUSDT', 'side': 'BUY', 'price': '0', 'quantity': '15', 'order_id': 65468744, 'transact_time': 40198877844, 'transact_date': '2021-12-22'} As you can see, the price is 0, even if this is not the case. Do you have answers. I do a 'POST' request to this endpoint '/fapi/v1/order'. :) thanks a lot. source https://stackoverflow.com/questions/70454113/problem-to-get-order-price-on-binance-futures-api

how to edit the response fields in node-soap

I have the following WSDL definition: <definitions targetNamespace="http://app.com/app" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:app="http://app.com/app" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <message name="SoapQuery"> <part name="TransType" type="xsd:string" /> </message> <message name="SoapQueryResult"> <part name="ResponseCode" type="xsd:string"/> <part name="ResultDesc" type="xsd:string" /> </message> <portType name="SoapQuery_PortType"> <operation name="SoapQuery"> <input message="SoapQuery" /> <output message="SoapQueryResult" /> </operation> </portType> <binding name="SoapQuery_Bind