Author Archives: Robins

CheXNet-master: CUDA out of memery [How to Solve]

add with torch.no_grad() before for i, (inp, target) in enumerate(test_loader): no error will be reported

with torch.no_grad():
    for i, (inp, target) in enumerate(test_loader):
        target = target.cuda()
        gt = torch.cat((gt, target), 0)
        bs, n_crops, c, h, w = inp.size()
        input_var = torch.autograd.Variable(inp.view(-1, c, h, w).cuda())
        output = model(input_var)
        output_mean = output.view(bs, n_crops, -1).mean(1)
        pred = torch.cat((pred, output_mean.data), 0)

But the effect is not good

The average AUROC is 0.531
The AUROC of Atelectasis is 0.552835646499197
The AUROC of Cardiomegaly is 0.4891981635698571
The AUROC of Effusion is 0.5078801344734772
The AUROC of Infiltration is 0.5471494224277326
The AUROC of Mass is 0.5019205110036506
The AUROC of Nodule is 0.48564796421763534
The AUROC of Pneumonia is 0.49787587924670523
The AUROC of Pneumothorax is 0.46888930706822896
The AUROC of Consolidation is 0.45797680791836254
The AUROC of Edema is 0.5500617972215441
The AUROC of Emphysema is 0.7189693346796524
The AUROC of Fibrosis is 0.548014619318718
The AUROC of Pleural_Thickening is 0.47339353023337755
The AUROC of Hernia is 0.638215609588036

[Solved] AttributeError: module ‘tensorflow‘ has no attribute ‘distributions‘

Recently, I was watching Mo fan’s PPO code running problems

norm_dist = tf.distributions.Normal(loc=mu, scale=sigma)

report errors:

AttributeError: module 'tensorflow' has no attribute 'distributions'

TF. Distributions is one of the core components provided by tensorflow. It is used to implement some common probability distributions and gives a series of auxiliary calculation functions.

The reason for the problem:
I didn’t look carefully. Mo fan’s version of TensorFlow is TensorFlow r1.3
his version is too old. It’s better to upgrade 1.2.0 to the same version
pay attention to the version of the code in the future

[Solved] Timeout failure when upgrading horizon DAAS from 9.0.1/20.2.0 to 9.1.0/21.1.0

Problem Description
When we upgrade from VMware Horizon DaaS 9.0.1/20.2.0 to Horizon Daas 9.1.0/21.1.0, an error is reported on the HAL side and the upgrade fails with an error similar to the following in the HAL’s /var/log/horizon-air-link.log log.
2021-01-15T06:29:39,987 INFO [jersey-server-managed-async-executor-15] ApplianceNetworkAdapterAction – Updating network for appliance example.local, adapter: NetworkAdapterSpec{deviceIndex=1, connected=true, connectedOnStartup=true, network=‘null’}
2021-01-15T06:29:41,102 INFO [jersey-server-managed-async-executor-15] SpHalApiKeySyncAction – [10.11.3.224/example.local] running Synckey on the appliance.
2021-01-15T06:29:41,453 INFO [jersey-server-managed-async-executor-15] SpHalApiKeySyncAction – [10.11.3.224/example.local] Running script ‘sync-api-key’
2021-01-15T06:32:50,995 ERROR [jersey-server-managed-async-executor-15] AbstractAction – Error in abstract Action
com.vmware.vim25.InvalidState: null
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:?]
at java.lang.Class.newInstance(Unknown Source) ~[?:?]
at com.vmware.vim25.ws.XmlGen.fromXml(XmlGen.java:205) ~[smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.vim25.ws.XmlGen.parseSoapFault(XmlGen.java:82) ~[smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:134) ~[smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.vim25.ws.VimStub.listProcessesInGuest(VimStub.java:3820) ~[smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.vim25.mo.GuestProcessManager.listProcessesInGuest(GuestProcessManager.java:68) ~[smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.smartnode.bootstrap.vim.VijavaGuestClient.executeInGuest(VijavaGuestClient.java:118) ~[smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.hdaas.flow.SpHalApiKeySyncAction.doAction(SpHalApiKeySyncAction.java:138) ~[smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.smartnode.flow.AbstractAction.run(AbstractAction.java:94) [smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.smartnode.flow.CompositeAction.doAction(CompositeAction.java:53) [smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.smartnode.flow.AbstractAction.run(AbstractAction.java:94) [smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.smartnode.flow.FallbackAction.doAction(FallbackAction.java:25) [smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.smartnode.flow.AbstractAction.run(AbstractAction.java:94) [smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.smartnode.flow.CompositeAction.doAction(CompositeAction.java:53) [smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at com.vmware.smartnode.flow.AbstractAction.run(AbstractAction.java:94) [smartnode-bootstrap-21.1.0-all.jar:21.1.0-17336825]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
at java.lang.Thread.run(Unknown Source) [?:?]
2021-01-15T06:32:50,999 ERROR [jersey-server-managed-async-executor-15] AbstractAction – Error in abstract Action
com.vmware.vim25.InvalidState: null
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
In addition, you will see a similar message in the setup log of the SP1 device that has been created.
2021-01-15,06:29:43 [HAL restore – DB changes]: ******* Sync API key *******
2021-01-15,06:29:43 [HAL restore – DB changes]: Update API key into cloud_config
UPDATE 1
2021-01-15,06:29:43 [HAL restore – DB changes]: Update HAL ip address
INSERT 0 0
2021-01-15,06:29:43 [restart dtService]: Restarting dtService…
[sudo] password for desktone: 2021-01-15,06:32:53 [Appliance Services]: ******* Started handling appliance services for ‘stop’ action *******
2021-01-15,06:32:53 [Appliance Services]: Proceeding with ‘stop’ for services ‘dtService memcached dbmonitor slons’ on SP appliance
2021-01-15,06:32:53 [Appliance Services]: Service Name:dtService, Action:stop
Job for dtService.service canceled.
2021-01-15,06:32:53 [Appliance Services]: Service Name:memcached, Action:stop
Cause.
The issue is caused by a timeout due to a high load on vCenter Server during deployment causing the SP1 appliance to take longer to reboot. This is a known issue with 9.0.1/20.2.0 upgrades to 9.1.0/21.1.0 for which there is no official VMware solution.
Temporary treatment.
Please check to make sure that the vCenter instance and vCenter cluster cluster load at the location where the SP is part of is not under tension before trying to schedule the deployment task again.

[Solved] Circular view path [index]: would dispatch back to the current handler URL [] again. Che

Error report content
circular view path [index]: would dispatch back to the current handler URL// login/index] again. Check your viewresolver setup( Hint: This may be the result of an unspecified view, due to default view name generation.)

Change @ controller to @ restcontroller

The @restcontroller annotation is equivalent to the function of @ResponseBody + @ controller
without annotation, @ResponseBody or @restcontroller will set the return value to JSON format, otherwise it will automatically think that you are returning a page
in the @ controller annotation, you can return a string or a template name that matches the string, that is, directly render the view and use it with HTML pages,

In this case, the front-end and back-end requirements are relatively high. The Java back-end code should be rendered in combination with HTML. The data of the model object (or modelandview) will be used to fill in the relevant attributes in the user view, and then displayed to the browser. This process can also be called rendering

In @restcontroller, you should return an object, that is, return a user object. At this time, you can also see that the return is a JSON string corresponding to a user object without a page. The function of the front end is to use the returned JSON to parse and render the page, and the code of the Java back end is relatively free.

Method to solve uncaught typeerror: cannot set property ‘onclick’ of null error

Problem analysis: this error occurs when the JS file is placed in the head tag and the onclick event is bound

reason:

W3school introduces that the browser loads the button node before executing JS. When the browser parses from top to bottom, the button node bound to onclick cannot be found

For example:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Events</title> 
<script>
    var Btn = document.getElementById('btn');
    Btn.onclick = function(){    
        console.log("push the button ");        
    }
</script> 
</head> 
<body> 
   <button id="btn">Calculation</button> 
</body>
</html>

This error will appear, as shown in the following figure:

Solution 1: use the JS content in window ο nl ο Ad = function () {} wrap it up

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Events</title>
    <script>
        window.onload = function () {
            var Btn = document.getElementById('btn');
            Btn.onclick = function () {
                console.log("push the button ");
            }
        }
    </script>
</head>
<body>
    <button id="btn">Calculation</button>
</body>
</html>

Solution 2: load the JS file at the bottom

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Events</title>
</head>
<body>
    <button id="btn">Calculation</button>
    <script>
        var Btn = document.getElementById('btn');
        Btn.onclick = function () {
            console.log("push the button ");
        }
    </script>
</body>
</html>

[Solved] Springboot WARNING: All illegal access operations will be denied in a future release

1、 Problem description

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/C:/Users/.m2/repository/org/springframework/spring-core/5.2.8.RELEASE/spring-core-5.2.8.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

2、 Solutions

There are many versions on the Internet,

1. Reduce JDK version, such as using java 11, change to Java 8

2. Add the following method to the startup class. Call this method when starting springboot to test the effectiveness of JDK 11

public static void disableWarning() {
    try {
      Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
      theUnsafe.setAccessible(true);
      Unsafe u = (Unsafe) theUnsafe.get(null);

      Class cls = Class.forName("jdk.internal.module.IllegalAccessLogger");
      Field logger = cls.getDeclaredField("logger");
      u.putObjectVolatile(cls, u.staticFieldOffset(logger), null);
    } catch (Exception e) {
      // ignore
    }
  }

  public static void main(String[] args) {
    disableWarning();
    SpringApplication.run(CpmApiApplication.class, args);
  }

[How to Solve] Idea prompt does not support Lombok

IDEA suggests that lombok is not supported
IDEA version Community 2021.1
When debugging: “You aren’t using a compiler supported by lombok, so lombok will not work and has been disabled. ”
Solution.
File -> Settings -> Build,Execution,Deployment -> Compiler -> Shared build process VM options
Fill in:-Djps.track.ap.dependencies=false

Solution of adding H264 error in ffmpeg compilation

Error: libavcodec/libx264.c:282:9: error: ‘x264_bit_depth’ undeclared
Solution: Open the x264 header file x264_config.h
Found in.

#define X264_BIT_DEPTH     8
#define X264_GPL           1
#define X264_INTERLACED    1
#define X264_CHROMA_FORMAT 0
#define X264_VERSION ""
#define X264_POINTVER "0.148.x"

Then it is found that there is a case problem
and open the ffmpeg source code to replace x264_bit_Depth is x264_ BIT_ Depth 0 was compiled and passed

[Solved] ORA-00020: maximum number of processes (150) exceeded

[oracle@db ~]$ sqlplus/as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 16 15:16:06 2020

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

ERROR:
ORA-00020: maximum number of processes (150) exceeded
Method 1: Change the processes parameter
To solve the ORA-00020 error, you can increase the parameter value of processes, but you need to start the database normally and log in successfully before you can modify it.
1. Firstly, log in the database successfully by adding the parameter “-prelim”.

1
2
3
4
5
[oracle@db ~]$ sqlplus -prelim/as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 16 15:22:07 2020

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

At this point, the database can be closed and opened normally, following the following command to solve the problem.

1
2
3
4
5
6
7
SQL> shutdown immediate;
SQL> startup;
SQL> show parameter processes;
SQL> alter system set processes=1000 scope=spfile;
SQL> startup force;
SQL> show parameter processes;
SQL> exit;

2.Start-up example

1
2
3
4
5
6
7
8
9
SQL> startup
ORACLE instance started.
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0SQL> exit
Disconnected from ORACLE

It means that it is already open.
3. Modify the parameters

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
[oracle@db ~]$ sqlplus/as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 16 15:22:35 2020

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show parameter process

NAME                                 TYPE        VALUE
———————————— ———– ——————————
aq_tm_processes                      integer     1
cell_offload_processing              boolean     TRUE
db_writer_processes                  integer     2
gcs_server_processes                 integer     0
global_txn_processes                 integer     1
job_queue_processes                  integer     1000
log_archive_max_processes            integer     4
processes                            integer     150
processor_group_name                 string
SQL> select status from v$instance;

STATUS
————
STARTED

SQL> alter system set processes=1000 scope=spfile;

System altered.

SQL> shutdown immediate;
ORA-01507: database not mounted

ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

4. Restart the instance

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[oracle@db ~]$ sqlplus/as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 16 15:24:59 2020

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 6313463808 bytes
Fixed Size                  2264976 bytes
Variable Size            1476395120 bytes
Database Buffers         4815060992 bytes
Redo Buffers               19742720 bytes
Database mounted.
Database opened.
SQL> show parameter processes;

NAME                                 TYPE        VALUE
———————————— ———– ——————————
aq_tm_processes                      integer     1
db_writer_processes                  integer     2
gcs_server_processes                 integer     0
global_txn_processes                 integer     1
job_queue_processes                  integer     1000
log_archive_max_processes            integer     4
processes                            integer     1000

.
Method 2: Kill all oracle processes

1
2
$ ps -ef |grep $ORACLE_SID|grep -v grep|awk ‘{print $2}’ | xargs kill -9
$ ipcs -m | grep oracle | awk ‘{print $2}’ | xargs ipcrm shm

Spring Cloud Hoxton.SR9 gateway and reactor-netty 0.9.0.RELEASE is Incompatible [How to Solve]

Spring cloud hoxton.sr9 gateway is not compatible with reactor netty 0.9.0.release

An error occurred when starting the spring cloud Gateway project
runtime

Spring boot version: 2.2.0.release
spring cloud version: Hoxton. SR9
spring cloud Alibaba version: 2.2.1.release

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.cloud.gateway.config.GatewayAutoConfiguration$NettyConfiguration.gatewayHttpClient(GatewayAutoConfiguration.java:675)

The following method did not exist:

    'reactor.netty.resources.ConnectionProvider reactor.netty.resources.ConnectionProvider.elastic(java.lang.String, java.time.Duration, java.time.Duration)'

The method's class, reactor.netty.resources.ConnectionProvider, is available from the following locations:

    jar:file:/E:/apache-maven-3.6.3/repo/io/projectreactor/netty/reactor-netty/0.9.0.RELEASE/reactor-netty-0.9.0.RELEASE.jar!/reactor/netty/resources/ConnectionProvider.class

It was loaded from the following location:

    file:/E:/apache-maven-3.6.3/repo/io/projectreactor/netty/reactor-netty/0.9.0.RELEASE/reactor-netty-0.9.0.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of reactor.netty.resources.ConnectionProvider


Process finished with exit code 1

Try to upgrade the reactor netty version to 0.9.4. Release
as a result, the spring weblux version is incompatible

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.cloud.gateway.config.GatewayAutoConfiguration$NettyConfiguration.reactorNettyWebSocketClient(GatewayAutoConfiguration.java:803)

The following method did not exist:

    'void org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient.setHandlePing(boolean)'

The method's class, org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient, is available from the following locations:

    jar:file:/E:/apache-maven-3.6.3/repo/org/springframework/spring-webflux/5.2.0.RELEASE/spring-webflux-5.2.0.RELEASE.jar!/org/springframework/web/reactive/socket/client/ReactorNettyWebSocketClient.class

It was loaded from the following location:

    file:/E:/apache-maven-3.6.3/repo/org/springframework/spring-webflux/5.2.0.RELEASE/spring-webflux-5.2.0.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient


Process finished with exit code 1

Restore the original version, and finally downgrade the spring cloud version to hoxton.sr1. It runs successfully. As a result, a new hole appears, and Nacos has a version incompatibility problem. There is no way to find the official recommended configuration of spring cloud Alibaba, and modify the spring boot, spring cloud, and spring cloud Alibaba versions. It runs successfully

Spring boot version: 2.3.2. Release
spring cloud version: Hoxton. SR8
spring cloud Alibaba version: 2.2.5. Release


Attach the official recommended version address of spring cloud Alibaba
recommended version

[Solved] ModuleNotFoundError: No module named ‘xxx’; ‘xxx’ is not a package

ModuleNotFoundError: No module named ‘xxx’; ‘xxx’ is not a package
Error.
ModuleNotFoundError: No module named ‘xxx’; ‘xxx’ is not a package
When debugging the script via pycharm, the following error occurs:
ModuleNotFoundError: No module named ‘xml.parser’; ‘xml’ is not a package
Cause.
project
|– xml
|– xml.py
Package name and .py file conflict
Solution.
Change the package name and the .py file name to be inconsistent