RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes' failed. at c:\programdata\miniconda3\conda-bld\pytorch-cpu_1532498166916\work\aten\src\thnn\generic/ClassNLLCriterion.c:93
The
assertion function returns an error, requiring the target class to be greater than or equal to 0 and less than or equal to the input class, but not satisfying.
often encounter this problem in classification training. Generally speaking, this error will occur when the number of categories output in our network is different from the number of categories set by your label.
USES find to remove background class 0 in experimental classification on matlab, so all categories start from 1. There is no problem in classification on matlab, but Pytorch has a requirement that the label must start with 0 when CrossEntropyLoss is used for verification, so it will give an error
please
in
place
Richard
After the
back
scene
class
the
after
will
the
There are
the
class
Don’t
mark
sign
Reduction of
1
\ leftarRow Subtracting all category labels by 1 after processing the background class
span> span> please span> span> span> span> in span> at span> Daniel span> the span> back span> view span> class span> span> of
Read More:
- Python learning notes (5) — cross entropy error runtimeerror: 1D target tensor expected, multi target not supported
- Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://xxx.cn’) does n
- [problem solving] target is multiclass but average =’binary ‘. Please choose another average setting
- When docker starts tomcat, the access port of the container displays 404, and the source server fails to find the representation of the target resource or is unwilling to disclose an existing one
- The key “target densitydpi” is not supported
- TNS-12545: Connect failed because target host or object does not exist
- When using ionic to build Android APK, Cordova error is reported: requirements check failed for JDK 1.8 or greater
- ORA-12545: Connect failed because target host or object does not exist
- Solve the problem that target code version of Maven project sub module in IntelliJ idea is always rolled back
- Syntax error, annotations are only available if source level is 1.5 or greater
- Uncaught Error: _registerComponent(…): Target container is not a DOM element
- Version 1.8.0_201 of the JVM is not suitable for this product. Version: 11 or greater is required.
- Error: Target container is not a DOM element.
- How to solve the problem of “version 11 or greater is required” in eclipse 2020
- Syntax error, annotations are only available if source level is 1.5 or greater.
- [Solved] error: Microsoft Visual C++ 14.0 or greater is required
- The route addition failed: Either the interface index is wrong or the gateway do es not lie on the s
- Eclipse Syntax error, annotations are only available if source level is 1.5 or greater
- “Syntax error, annotations are only available if source level is 1.5 or greater”
- Jstack command execution error: unable to open socket file: target process not responding or hotspot VM not loaded