weightofsize[64,3,7,7],expectedinput[1,4,512,1024]tohave3channels,butgot4channels
For the record only,Please skip. After the blogger’s article,The blogger opened a new picture,After feeding the model-this problem occurred again:weight of size [ 64, 3, 7, 7], expected input[1, 4, 512, 1024] to have 3 channels, but got 4 channels instead That is, the original three-channel picture, ; After reading, it becomes four channels. Solution Add .convert('RGB'),Yes Image.open functionCaused That’s it. Thanks to the big blogger for the article :Portal
Use js to adjust table cell height and width, compatible with merged cells (compatible with IE6, 7, 8, FF) examples_javascript skills
First, the renderings: CSS: The code is as follows: body{margin:0px;padding:0px;-moz-user-select:none;cursor:default;} .tabEditDiv{position:absolute;width:15px;height:15px;cursor:pointer;}.seltab{position:absolute;width:15px;height:15px;cursor:pointer;background:url(images /seltab.gif) no-repeat;}.splitx{overflow:hidden;position:absolute;height:3px;cursor:row-resize;background:red !important;filter:Alpha(opacity=10);- moz-opacity:0.1;opacity: 0.1; }.splity{overflow:hidden;position:absolute;width:3px;cursor:col-resize;background:red !important;filter:Alpha(opacity=10); -moz-opacity:0.1;opacity: 0.1;}#tabletitle{font-weight:bold;font-size:18px;height:30px;width:800px;margin:0 auto;text-align:center;font -family:宋体;line-height:30px;}#tabletitle input{width:100%;border:0px;height:28px;line-height:30px;text-align:center;font-weight:bold; font-size:18px;font-family:宋体;}.finelinetable{border-right:1px solid #000;border-top:1px solid #000;border-collapse:collapse;font-size:13px;width :800px;margin:0 auto;}.finelinetable td{border-left:1px solid #000;border-bottom:1px solid #000;height:25px;} HTML: The code is as follows: Table title 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 JS: The code is as follows: //Note: Get the object. Example: $(“objectId”) is equivalent to document.getElementById(“objectId”) if (typeof $ != “function”) { var $ = function (ids) { return document.getElementById(ids) }; } //Note: Get coordinates, the last node of parentNode. Example: absPos(object).x function absPos(_node, parentNode) { var x = y = 0; var node = _node; do { if (parentNode && node == parentNode) { break; } x += node.offsetLeft; y += node.offsetTop; } while (node = node.offsetParent); node = _node; return { ‘x’: x, ‘y’: y }; } function addEvent(object, event, func) { if (object.addEventListener) { /* W3C method (DOM method) The false in the following statement means to use In the bubbling phase, if true, it is used in the capturing phase (IE does not support capturing), so false is used here partly for the sake of…
Use js to adjust table cell height and width, compatible with merged cells (compatible with IE6, 7, 8, FF) examples_javascript skills
First, the renderings: CSS: The code is as follows: body{margin:0px;padding:0px;-moz-user-select:none;cursor:default;} .tabEditDiv{position:absolute;width:15px;height:15px;cursor:pointer;}.seltab{position:absolute;width:15px;height:15px;cursor:pointer;background:url(images /seltab.gif) no-repeat;}.splitx{overflow:hidden;position:absolute;height:3px;cursor:row-resize;background:red !important;filter:Alpha(opacity=10);- moz-opacity:0.1;opacity: 0.1; }.splity{overflow:hidden;position:absolute;width:3px;cursor:col-resize;background:red !important;filter:Alpha(opacity=10); -moz-opacity:0.1;opacity: 0.1;}#tabletitle{font-weight:bold;font-size:18px;height:30px;width:800px;margin:0 auto;text-align:center;font -family:宋体;line-height:30px;}#tabletitle input{width:100%;border:0px;height:28px;line-height:30px;text-align:center;font-weight:bold; font-size:18px;font-family:宋体;}.finelinetable{border-right:1px solid #000;border-top:1px solid #000;border-collapse:collapse;font-size:13px;width :800px;margin:0 auto;}.finelinetable td{border-left:1px solid #000;border-bottom:1px solid #000;height:25px;} HTML: The code is as follows: Table title 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 JS: The code is as follows: //Note: Get the object. Example: $(“objectId”) is equivalent to document.getElementById(“objectId”) if (typeof $ != “function”) { var $ = function (ids) { return document.getElementById(ids) }; } //Note: Get coordinates, the last node of parentNode. Example: absPos(object).x function absPos(_node, parentNode) { var x = y = 0; var node = _node; do { if (parentNode && node == parentNode) { break; } x += node.offsetLeft; y += node.offsetTop; } while (node = node.offsetParent); node = _node; return { ‘x’: x, ‘y’: y }; } function addEvent(object, event, func) { if (object.addEventListener) { /* W3C method (DOM method) The false in the following statement means to use In the bubbling phase, if true, it is used in the capturing phase (IE does not support capturing), so false is used here partly for the sake of…
JavaScript variable:vara=(3,4,7);
It’s called the comma operator. By wrapping the right-hand expression in parentheses, we create a group and evaluate each of its operands and return The last value. From MDN The comma operator evaluates each of its operands (from left to right) and returns the value of the last operand. The comma operator is useful when you want to write a minifier and need to shrink the code. For example, print = () => console.log(‘add’) add_proc = (a,b) => a + b function add(a, b){ if(a && b){ print(); return add_proc(a,b) } else { return 0 } } console.log(add(1,2)); You can use the comma operator to reduce it as follows: print = () => console.log(‘add’) add_proc = (a,b) => a + b add = (a, b)=> a && b ?(print(),add_proc(a, b)):0 console.log(add(1,2)); 1> Mihai Alexan..: It is called the comma operator. Expressed by the right hand Formula wrapped in parentheses, we create a group, evaluate each of its operands and return the last value. From MDN The comma operator evaluates each of its operands (from left to right) and returns the value of the last operand. The comma operator is useful when you want to write a minifier and need to…
Write java to merge two arrays, {1,2,3,4,5}{4,5,6,7,8}
Java writes two arrays to merge, {1,2,3,4,5} {4,5,6,7,8} It is divided into two steps: 1. Connect the two arrays.2. Clear duplicate elements.import java.util.Arrays; public class Combine{ public static void main(String[] args){ int a[]={1,2,3,4,5}; int b[]={ 4,5,6,7,8}; int temp[]=new int[a.length+b.length]; //Connect two arrays for(int i=0;ijava writes to merge two arrays, {1 ,2,3,4,5} {4,5,6,7,8} < How to combine java string arrays into one array in java? h3> java
Write java1,1,2,4,7,13,24,44 algorithm in java
//Use java to write java1,1,2,4,7,13,24,44 algorithm —- Baidu knowsimport java.util.ArrayList;import java.util.List;import java.util.Scanner;public class Result {//The first three numbersprivate int a = 1, b = 1, c = 2;private List list = null;//Construction methodResult() {list = new ArrayList();list.add(a);list.add(b);list.add(c);}//Return resultpublic int getResult(int index) {if(index >= 0 && index <=3) {return list.get(index);} else if(index < 0) {return – 1;}return calc(index).get(index);}//Calculate the sum and add it to the collectionprivate List calc(int index) {for(int i=3; i<=index; i++) {//Each number is equal to the sum of the first threeint temp = list.get(i-1) + list. get(i-2) + list.get(i-3);list.add(temp);}return list;}public static void main (String[] args) {System.out.println(“Please enter the location:”);int index = new Scanner(System.in).nextInt();System.out.println (The result of the “th” + index + ” position is: ” + new Result().getResult(index – 1));}}This type of article is only For record purposes. This article comes from the “IT Traveler” blog, please be sure to keep this source http://fylxopensource.blog.51cto.com/1328715/1543520
java (nine-nine multiplication table output 1,3,5,7,9)
1*1=1 1*3=3 2*3=6 3*3=9 1*5=5 2*5=10 3*5=15 4*5=20 5*5=25 1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49 1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81 The code is as follows: package jiujiu; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class Jiu { public void Dayin(String filedy){ for(int i=1;i<=9;i++){ for(int j=1;j<=i ;j++){ if(i%2==1){ int ji=j*i; String str1=j+”*”+i+”=”+ji+” “; writefile(str1,filedy); }else{ } } String str2=”\r\n”; writefile(str2,filedy); } } private void writefile(String data,String filedy) { // TODO Auto-generated method stub File file=new File(filedy); if(!file.exists()){ try { file.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } OutputStream os=null; try { os=new FileOutputStream(file,true); byte[]bytes=data.getBytes(); os.write(bytes); os.flush(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }finally { try { if(os!=null){ os.close(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public static void main(String[] args){ Jiu jiu=new Jiu(); jiu.Dayin(“f:/test/444.txt”); } } Execution result:
Java5, 6, 7, 8, 9, 10, 11 new features
Reprinted from https://it18monkey.github.io java5 Generics List list=new ArrayList (); Enhanced for Loop int[] array = { 1, 2, 3, 4, 5}; for (int i : array) { System.out.println(i); } Autoboxing/Unboxing (Autoboxing/Unboxing). The eight basic types and their packaging classes can be automatically converted to each other. Enumeration (Typesafe Enums). ps: Enumeration is a good way to implement thread-safe singleton mode. enum TestEnum{ one, two; TestEnum() { } } Varargs Syntax: (type… arguments) The essence of variable parameters is still to use a Arrays store parameters, but Java hides this process. It should be noted that if a method declaration contains variable parameters, they must be placed in the last position. /** * Variable parameter test* * @param args */ public static void testVarargs(String… args) { //Essentially it is an array System.out.println( args[1]); for (String arg : args) { System.out.println(arg); } } Static Import. Use the static variables or methods in the class by importing the class (directly through the name, no need to add class name.), which simplifies code writing. //Single importimport static java.lang.Math.PI; //Batch importimport static java.lang.Math.*; ps: In past versions It can only be used by inheriting a class or implementing an interface. Annotations. Keyword @interface. //Annotations of…