on-internet

Refine segmentation mask based on contours of image

I have an image for which I have the green border as the segmentation mask's outline. I'm looking to refine this outline based on contours found on the original image, to get a mask like the in 2nd image - where the edges of the hair are more refined. I've tried combinations of dilation & erosion of the segmentation mask, but it didn't feel like a generic solution - since it involves manually tuning the kernel size. Are there better approaches?

Join the discussion →

Understanding backward hooks

I wrote this snippet below to try and understand what's going on with these hooks. class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.fc1 = nn.Linear(10,5) self.fc2 = nn.Linear(5,1) self.fc1.register_forward_hook(self._forward_hook) self.fc1.register_backward_hook(self._backward_hook) def forward(self, inp): return self.fc2(self.fc1(inp)) def _forward_hook(self, module, input, output): print(type(input)) print(len(input)) print(type(output)) print(input[0].shape) print(output.shape) print() def _backward_hook(self, module, grad_input, grad_output): print(type(grad_i

Join the discussion →

deps.json file is not found in project root folder

I run the following command in Package Manager in Visual Studio 2019 and a ASP.NET Core 5 project: Scaffold-DbContext "Server=(local);Database=MyDB;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Entities -Context ApplicationDbContext After a little time, this error appears: The specified deps.json [C:\WorkingFolder\Projects\MyProject\MyProject.deps.json] does not exist Notice that the deps.json file is being searched in project root, not under bin folder such as other posts I have found here, so by deleting bin and obj folder does not help. How to solve it?

Join the discussion →

Opencv import issue in windows 10 [duplicate]

I have an issue with OpenCV in windows 10. Whenever I try to import OpenCV I get following error. import cv2 ** On entry to DGEBAL parameter number 3 had an illegal value ** On entry to DGEHRD parameter number 2 had an illegal value ** On entry to DORGHR DORGQR parameter number 2 had an illegal value ** On entry to DHSEQR parameter number 4 had an illegal value Traceback (most recent call last): File "C:\Users\Krishhnandu\AppData\Roaming\Python\Python39\site-packages\numpy\__init__.py", line 305, in <module> _win_os_check() File "C:\Users\Krishhnandu\AppData\Roaming\Python\Python39\site-packag

Join the discussion →

Failed assertion: line 5070 pos 12: '': is not true

After a user successfully logins in and saving the state, I want to hide the login screen and just load the home screen, but I end up with the error The following assertion was thrown building Navigator-[GlobalObjectKey _WidgetsAppState#6686e](dirty, dependencies: [UnmanagedRestorationScope, HeroControllerScope], state: NavigatorState#c7e9f(tickers: tracking 1 ticker)): 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 5070 pos 12: '': is not true. What is the right way of hiding the login screen when the token is still valid, and just load the home screen? my code Main.dart

Join the discussion →

Error running npm install, returns This is a bug in `node-gyp`

I am new to Angular and Node. I am trying to execute an project created using Angular, Neo4j. At first, I tried to run it as it is. However, i am givem the following error after opening the browser: NullInjectorError: StaticInjectorError(AppModule)[RouterScroller -> >ViewportScroller]: StaticInjectorError(Platform: core)[RouterScroller -> ViewportScroller]: NullInjectorError: No provider for ViewportScroller! ERROR Error: Uncaught (in promise): Neo4jError: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Dr

Join the discussion →

Where are the files from the `Samples` tab in the `LINQPad Tutorial & Reference` folder (see the picture)?

Question. Where are the files from the Samples tab in the LINQPad Tutorial & Reference folder (see the picture)? Description. I need files from the LINQPad Tutorial & Reference folder. I searched in the folder C:\Users\admin\AppData\Roaming\LINQPad\Samples. I can't find the folder - LINQPad Tutorial & Reference. I only see the C# 8.0 in a Nutshell - All Chapters folder. I imported this folder later.

Join the discussion →

How to force install package with Pip?

I am trying to install pyside with Python 3.8. It is stating that I need Python [(2, 6), (2, 7), (3, 2), (3, 3), (3, 4)]. Is there a way I can force install and override this requirement?

Join the discussion →

Not allowed to launch '' because a user gesture is required

I have problem part code. I am developing an extension. I am trying to open link using my app. var tab; const context = chrome || browser; if (tab.url.includes("youtube.com/watch?")) { context.tabs.update(tab.id, { url: "nameOfMyProgram:" + tab.url }); // Not allowed to launch //'<URL>' because a user gesture is required. } The problem occurs in the opera browser The first time it hits the web page, it works correctly. On subsequent clicks, an error "Not allowed to launch '' because a user gesture is required." This works correctly in the chrome browser. How can I solve this problem? I have pe

Join the discussion →

UK tax on an amber painting coming from abroad

Unsure if this is in the right section of Stack Exchange but, I have a family member coming to the UK (from outside of the EU) in the near immediate future. They will be bringing a painting with them that contains at least 100g of Amber, if not more. It's a gift. Will they have to declare this upon arrival? And will they have to pay tax on this? I am not sure how much the painting costs exactly, but it's less than £100 for sure. It's coming from Ukraine. Are there any official bodies I can contact in the UK to find out for sure? Again, apologies if this is in the incorrect section.

Join the discussion →

Why is searching by Class Chain in iOS faster than XPath?

I am working on an Appium project to automate an app using Python in both iOS and Android. I usually stick with using XPath to search for elements but in iOS, there is a wonderful searching mechanism called Class Chain, which allows you to search by element's class, such as XCUIElementTypeStaticText for XCUITest. So I was comparing the performance of searching by XPath and Class Chain, to which I found out that Class Chain performance is much faster than XPath, up to 7 times faster. A search that takes XPath 7 seconds can be done in just 1 second using Class Chain. Example: A simple search for

Join the discussion →

Agda list last of a generic list of naturals concatenated with a list of 1

I have the function: natListLast : List ℕ → ℕ natListLast [] = 0 natListLast nats@(x ∷ xs) = v.last (v.fromList nats) When I do _ : natListLast (2 l.∷ l.[] l.++ 1 l.∷ l.[]) ≡ 1 _ = refl I don't get any error. But when I try to generalize this to an arbitrary List nat like so: natListConcatLast : (nats : List ℕ) → natListLast (nats l.++ 1 l.∷ l.[]) ≡ 1 natListConcatLast [] = refl natListConcatLast nats@(x ∷ xs) = ? I'm not sure what to replace ? with. I tried starting with begin: natListConcatLast : (nats : List ℕ) → natListLast (nats l.++ 1 l.∷ l.[]) ≡ 1 natListConcatLast [] = refl natListConc

Join the discussion →

Scraping EDGAR with Python code (Program 2) results in TypeError: a bytes-like object is required, not 'str'

I am trying to get the (10-K) filing of Amazon in the year of 2013. My Python program for this is not working, perhaps due to the Python version difference between Python 2's urllib2 and Python 3's urllib, I suppose. My problem is that I encountered the initial error: TypeError: a bytes-like object is required, not 'str' Please help me to get the result of "element4" other than "None" for the code and error below; import time import csv import sys CIK = '1018724' Year= '2013' FILE= '10-K' # Get the Master Index File for the given Year url='https://www.sec.gov/Archives/edgar/full-index/%s/QTR1/

Join the discussion →

Is it safe to use @SuppressLint("RestrictedApi") with AndroidX libraries?

I would like to know whether it is safe or not to use @SuppressLint("RestrictedApi") annotation. I am pretty sure that the answer is NO, so I want to ask why as well. I guess that the development team wanted to hide such "restricted code" from the API users. Probably due to changes in the future or because the code is intended to work as internal functionality Example code with androidx.preference:preference:1.1.1: public abstract class CustomAdapterPreferenceFragment extends PreferenceFragmentCompat { @Override protected PreferenceGroupAdapter onCreateAdapter(PreferenceScreen preferenceScreen

Join the discussion →

Java 8 to Java 11 migration issues with JAXB API

We are in process of migrating our projects from Java 8 to Java 11. One of the APIs is dependent on a library that utilizes JAXB. As we know JAXB was removed from JAVA 11 we started to include the JAXB dependencies in the POM of the library. <!-- https://mvnrepository.com/artifact/jakarta.xml.bind/jakarta.xml.bind-api --> <!-- API --> <dependency> <groupId>jakarta.xml.bind</groupId> <artifactId>jakarta.xml.bind-api</artifactId> <version>2.3.3</version> </dependency> <!-- Runtime --> <dependency> <groupId>org.glassfish.jaxb</groupId> <artifactId>jaxb-runtime</artifactId> <version>2.3.2</version

Join the discussion →

Save the data from a solver output to a list in Python

In python when you run a solver, it displays some details along with the solutions. For example, I used a solver called IPOPT using following code solver = SolverFactory('ipopt') solver.solve(model, tee=True) and, I got the following output from a solver: This is Ipopt version 3.11.1, running with linear solver mumps. Number of nonzeros in equality constraint Jacobian...: 6 Number of nonzeros in inequality constraint Jacobian.: 0 Number of nonzeros in Lagrangian Hessian.............: 3 Total number of variables............................: 4 variables with only lower bounds: 2 variables with l

Join the discussion →

Java org.apache.http.ssl.SSLContext not found

I am trying to build a HttpClient but can't just figure out how to resolve this ClassNotFound-Error. I installed "org.apache.httpcomponents:httpclient:4.1.3" with maven and several other libraries but yet i won't work. Code: import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.config.CookieSpecs; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.utils.URIBuilder; import org.apach

Join the discussion →

Ojalgo - Load Matrix from CSV

I have some large headered CSV file that contains values I would like to load into a Matrix. I have come across the LineSplittingParser class but cannot find good examples on how to use this to actually get a Matrix object from a file. Could anyone give a small example of how to achieve this?

Join the discussion →

Download file from FTP server to client using Node js

System architecture System consist of 3 components 1: FTP server: Used to store files. Can only be accessed by Node.js app. No direct access. 2: Node.js: Provides an API to interact with FTP server. Only way to interact with FTP server. Node.js app have no collection of files stored on FTP. Only provides method to work with FTP. Node.js app should not store any file uploaded from it and download from it. 3: Client: A user how will upload or download a file to FTP server by using Node.js app. What I have done: I am able to download the file stored on FTP by using basic-ftp package. Here is the

Join the discussion →

Azure web app and Azure ad http error 500.79 Internal server error

I created my azure web-app and created app registration. and connected Azure AD to my web app. I used express security and I also used advance security with client ID and client secret. I know there is a similar question about this error. but it is not clear answer. Most likely causes: IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred. IIS was not able to access the web.config file for the Web site or ap

Join the discussion →

Azure Blob: 403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.)

I have the sas token with write permission but when I am trying to write the blob getting the below error. Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:6c52482f-c01e-001c-5891-b2f06f000000 Time:2020-11-04T10:03:01.6761446Z Status: 403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.) ErrorCode: AuthenticationFailed Headers: x-ms-request-id: 6c52482f-c01e-001c-5891-b2f06f000000 x-ms-error-code: AuthenticationFailed D

Join the discussion →

Principal component analysis -> inverse/inverted pattern

I have implemented opensource principal component analysis (PCA) code in my Fortran code. I just input the multidimensional data in to a two-dimensional matrix (PCA_MATRIX(imagepixels_amount,image_count)) and out come the first (up to) seven transformed images of the PCA (they are written into the input matrix). It works fine in most cases, but in some I get an inverse pattern (in the first three components) which I do not understand, because all input images show a similar pattern. Am I missing a fundamental property of PCA which can cause such inverted patterns? The library I'm using is: htt

Join the discussion →

How to create ROM with VecInit(Array()) in Chisel?

I'm trying to declare a «rom» with VecInit() like it : val GbColors = VecInit(Array(GB_GREEN0, GB_GREEN1, GB_GREEN2, GB_GREEN3)) With GB_GREENx declared like it : class VgaColors extends Bundle { val red = UInt(6.W) val green = UInt(6.W) val blue = UInt(6.W) } //... object GbConst { //... /* "#9BBC0F"*/ val GB_GREEN0 = (new VgaColors()).Lit(_.red -> "h26".U(6.W), _.green -> "h2F".U(6.W), _.blue -> "h03".U(6.W)) /* "#8BAC0F"*/ val GB_GREEN1 = (new VgaColors()).Lit(_.red -> "h1E".U(6.W), _.green -> "h27".U(6.W), _.blue -> "h03".U(6.W)) /* "#306230"*/ val GB_GREEN2 = (new VgaColors()).Lit(_.red -

Join the discussion →

org.apache.spark.SparkException: Job aborted due to stage failure in databricks

Sorry, for same type of question. I saw so many post in SO for stage failure. But none of those were able to resolve my issue. So I'm posting it again. I'm running in databricks,Runtime 7.3 LTS. I have a spark dataframe df2.While I'm running the command df2.show() I'm getting following error message. Can you help me to resolve the issue? org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 231.0 failed 4 times, most recent failure: Lost task 0.3 in stage 231.0 (TID 6106, 10.52.98.16, executor 0): com.databricks.sql.io.FileReadException: Error while reading file db

Join the discussion →

Clang C++ new operator large dynamic array slow compile time

I am facing a very unusual issue using clang-1200.0.32.21 on Mac OS Catalina 10.15.7. Essentially, this code takes a long time to compile, and has extremely high RAM usage (peeks around 10GB of RAM): m_Table = new MapGenerator::Block[MAP_DIAMETER * MAP_HEIGHT * MAP_DIAMETER](); ===-------------------------------------------------------------------------=== Clang front-end time report ===-------------------------------------------------------------------------=== Total Execution Time: 50.8973 seconds (55.3352 wall clock) ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name -

Join the discussion →

How to display Jupyterlab output in new tab?

I am trying to get an output tab in Jupyterlab that shows the output of my code. Right now I can right-click on a cell output in the notebook and create an output view -- but this view does not update as I execute additional cells. Is there a way to do this (a setting or extension)? I envision something like the Python extension in VS Code that allows you to split the screen and run cell code on the left and see the output on the right.

Join the discussion →

Can we put blocks in blocks in CSS?

I'm new in CSS and I have a question about blocks (actually I don't know how do we name the 'blocks' like #my-id{color: yellow} so if you can also answer that it would be great) So, I wanted to know if it was possible to specifie how will type of a class comport, it would look like this: .my-class{ h1{ color: yellow; } p{ color: blue; } } I hope you understood what I want to explain, so please answer my two questions!!!

Join the discussion →
Older stories