Color faces in X3D not working - html

I've defined some faces in X3D and am trying to assign colours to them. I have the code below, but when I load the model, nothing appears and it just shows "hardware buffering". It loads ok (and shape is correct) when I get rid of the parts related to colour definition. Any ideas what's wrong here? Thanks!
<x3d>
<Scene>
<Group>
<Transform translation="0 1.829 0">
<Transform center="0 -1.829 0" rotation="0.0000 0.0000 -1.0000 1.5708" translation="18.288 -3.658 11.582">
<Transform center="0 -1.829 0" rotation="0 1 0 0.0000">
<Shape>
<Appearance><Material diffuseColor="0.0000 0.0000 1.0000"/></Appearance>
<IndexedFaceSet solid='true' coordIndex='0 1 2 3 -1 7 6 5 4 -1 0 4 5 1 -1 1 5 6 2 -1 2 6 7 3 -1 3 7 4 0 -1'>
<Coordinate point='-0.004 1.829 0.174 0.004 1.829 0.174 0.004 1.829 -0.174 -0.004 1.829 -0.174 -0.004 -1.829 0.174 0.004 -1.829 0.174 0.004 -1.829 -0.174 -0.004 -1.829 -0.174'/>
</IndexedFaceSet>
</Shape>
<Shape>
<Appearance><Material/></Appearance>
<IndexedFaceSet colorPerVertex='false' solid='true' colorIndex='1 1 0 1 1 1' coordIndex='0 1 2 3 -1 7 6 5 4 -1 0 4 5 1 -1 1 5 6 2 -1 2 6 7 3 -1 3 7 4 0 -1'>
<Color color="0.8627 0.8627 0.8627 0.0000 0.0000 1.0000"/>
<Coordinate point='-0.1015 1.829 0.174 0.1015 1.829 0.174 0.1015 1.829 0.16 -0.1015 1.829 0.16 -0.1015 -1.829 0.174 0.1015 -1.829 0.174 0.1015 -1.829 0.16 -0.1015 -1.829 0.16'/>
</IndexedFaceSet>
</Shape>
</Transform>
</Transform>
</Transform>
</Group>
</Scene>
</x3d>

The code was correct but the reason it wasn't working was that I was creating an .html file rather than an .xhtml file for x3dom.

Related

Tesseract fine tuning error - Compute CTC targets failed

I'm trying to fine-tune tesseract 4.1.1 on my own specific data according to this guide. I want it to become able to detect and recognize text in boxes like that:
I have generated a number of images like that and corresponding to them .box files containing bounding boxes with text. To reproduce my issue here i'm going to show my pipeline using only one image. Here is the .box file for the image above:
0 1804 1659 1858 1813 0
5 1804 1659 1858 1813 0
9 1804 1659 1858 1813 0
9 1266 715 1334 1169 0
7 1266 715 1334 1169 0
8 1266 715 1334 1169 0
3 1266 715 1334 1169 0
6 1266 715 1334 1169 0
8 1266 715 1334 1169 0
0 1266 715 1334 1169 0
5 1266 715 1334 1169 0
3 1266 715 1334 1169 0
2 876 303 930 607 0
7 876 303 930 607 0
2 876 303 930 607 0
8 876 303 930 607 0
2 876 303 930 607 0
2 876 303 930 607 0
8 1671 120 1725 224 0
0 1671 120 1725 224 0
5 300 1278 354 1482 0
2 300 1278 354 1482 0
3 300 1278 354 1482 0
7 300 1278 354 1482 0
7 917 1451 975 1605 0
6 917 1451 975 1605 0
4 917 1451 975 1605 0
1 1058 1310 1132 1716 0
9 1058 1310 1132 1716 0
8 1058 1310 1132 1716 0
7 1058 1310 1132 1716 0
7 1058 1310 1132 1716 0
1 1058 1310 1132 1716 0
8 1058 1310 1132 1716 0
6 1058 1310 1132 1716 0
3 998 76 1070 382 0
4 998 76 1070 382 0
4 998 76 1070 382 0
8 998 76 1070 382 0
3 998 76 1070 382 0
6 998 76 1070 382 0
3 722 548 776 652 0
2 722 548 776 652 0
7 1782 1332 1838 1586 0
7 1782 1332 1838 1586 0
2 1782 1332 1838 1586 0
6 1782 1332 1838 1586 0
2 1782 1332 1838 1586 0
1 714 140 768 244 0
2 714 140 768 244 0
0 220 500 278 754 0
5 220 500 278 754 0
5 220 500 278 754 0
6 220 500 278 754 0
6 220 500 278 754 0
8 1676 1052 1742 1406 0
4 1676 1052 1742 1406 0
5 1676 1052 1742 1406 0
9 1676 1052 1742 1406 0
1 1676 1052 1742 1406 0
2 1676 1052 1742 1406 0
4 1676 1052 1742 1406 0
5 357 161 419 317 0
1 357 161 419 317 0
4 357 161 419 317 0
9 1424 848 1480 952 0
8 1424 848 1480 952 0
0 438 324 498 478 0
6 438 324 498 478 0
9 438 324 498 478 0
8 1503 1246 1559 1700 0
1 1503 1246 1559 1700 0
8 1503 1246 1559 1700 0
5 1503 1246 1559 1700 0
3 1503 1246 1559 1700 0
0 1503 1246 1559 1700 0
5 1503 1246 1559 1700 0
5 1503 1246 1559 1700 0
4 1503 1246 1559 1700 0
8 1553 477 1609 581 0
4 1553 477 1609 581 0
3 527 258 581 512 0
7 527 258 581 512 0
7 527 258 581 512 0
9 527 258 581 512 0
1 527 258 581 512 0
6 1665 1592 1727 1748 0
8 1665 1592 1727 1748 0
3 1665 1592 1727 1748 0
5 595 1362 651 1766 0
9 595 1362 651 1766 0
3 595 1362 651 1766 0
9 595 1362 651 1766 0
4 595 1362 651 1766 0
3 595 1362 651 1766 0
3 595 1362 651 1766 0
1 595 1362 651 1766 0
I have also converted the image into .tiff format and placed it in the same directory with .box file. Lets say we have 87.tiff and 87.box inside the directory.
Next i generate 87.lstmf file using
tesseract 87.tiff 87 lstm.train
Next i extract model using
combine_tessdata -e /usr/share/tesseract-ocr/4.00/tessdata/rus.traineddata lstm_model/rus.lstm
Next i create train.txt file containing the single line: 87.lstmf
Finally, i create bash script train.sh
/usr/bin/lstmtraining \
--model_output output/fine_tuned \
--continue_from lstm_model/rus.lstm \
--traineddata /usr/share/tesseract-ocr/4.00/tessdata/rus.traineddata \
--train_listfile train.txt \
--eval_listfile train.txt \
--max_iterations 400\
--debug_level -1
And when i run it, i have the following logs:
$ bash train.sh
Loaded file lstm_model/rus.lstm, unpacking...
Warning: LSTMTrainer deserialized an LSTMRecognizer!
Continuing from lstm_model/rus.lstm
Loaded 1/1 lines (1-1) of document 87.lstmf
Loaded 1/1 lines (1-1) of document 87.lstmf
Compute CTC targets failed!
Compute CTC targets failed!
Compute CTC targets failed!
Compute CTC targets failed!
The message "Compute CTC targets failed!" repeats infinitely until i interrupt the script.
What am i doing wrong? I'm also concerned about message "Loaded 1/1 lines (1-1)" since i have multiple bounding boxes on the image.
For lstm training on images you may need to have the .box files in the new lstm format (these can be generated by running tesseract with the lstmbox argument):
TrainingTesseract-4.00
so after each line of text mark it with a special line:
<tab> <left> <bottom> <right> <top> <page>
then run lstm.train .

R and DBI dbWriteTable connection to MySQL/MariaDB only imports first row

I'm using an AWS mariaDB to store some data. My idea was to do the full management with the DBI package. However, I have found that DBI only imports the first row of the data when I try to write a table in the db. I have to use DBI::dbCreateTable and dbx::dbxInsert. I can't figure out why DBI is not importing the full data frame.
I have gone through this post but the conclusion is not quite clear. This is the code/output:
con <- DBI::dbConnect(odbc::odbc(), "my_odbc", timeout = 10)
## Example 1 - doesn't work
DBI::dbWriteTable(con, "test1", mtcars)
DBI::dbReadTable(con, "test1")
row_names mpg cyl disp hp drat wt qsec vs am gear carb
1 Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4
# Example 2 - doesn't work
DBI::dbCreateTable(con, "test2", mtcars)
DBI::dbAppendTable(con, "test2", mtcars)
[1] 1
DBI::dbReadTable(con, "test2")
mpg cyl disp hp drat wt qsec vs am gear carb
1 21 6 160 110 3.9 2.62 16.46 0 1 4 4
# Example 3 - does work.
DBI::dbCreateTable(con, "test3", mtcars)
dbx::dbxInsert(con, "test3", mtcars)
DBI::dbReadTable(con, "test3")
mpg cyl disp hp drat wt qsec vs am gear carb
1 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
2 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
3 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1
4 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1
5 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
6 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1
7 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4
8 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2
9 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2
10 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4
I had a similar issue and if you aren't careful with how you define and use your primary keys you get this issue. The first row is allowed as its the first with that primary key and then the rows after are blocked and hence dont get inserted.

Multi-GPU Peer-to-Peer Slow between Particular Pairs

I have 8 RTX GPUs. When run p2pBandwidthLatencyTest, The latencies between GPU0 and GPU1, GPU2 and GPU3, GPU4 and GPU5, GPU6 and GPU7 is 40,000 times slower than other pairs:
P2P=Enabled Latency (P2P Writes) Matrix (us)
GPU 0 1 2 3 4 5 6 7
0 1.80 49354.72 1.70 1.70 1.74 1.74 1.74 1.72
1 49354.84 1.37 1.70 1.69 1.74 1.76 1.73 1.72
2 1.88 1.81 1.73 49355.00 1.79 1.76 1.76 1.75
3 1.88 1.79 49354.85 1.33 3.79 3.84 3.88 3.91
4 1.89 1.88 1.90 1.87 1.72 49354.96 3.49 3.56
5 2.30 1.93 1.88 1.89 49354.89 1.32 3.63 3.60
6 2.55 2.53 2.37 2.29 2.24 2.26 3.50 49354.77
7 2.30 2.27 2.29 1.87 1.82 1.83 49354.85 1.36
Compare it with when peer-to-peer is disabled:
P2P=Disabled Latency Matrix (us)
GPU 0 1 2 3 4 5 6 7
0 1.80 14.31 13.86 13.49 14.52 13.89 13.58 13.58
1 13.71 1.82 14.44 13.95 14.65 13.62 15.05 15.20
2 13.38 14.23 1.73 16.59 13.77 15.44 14.10 13.64
3 12.68 15.62 12.50 1.77 14.92 15.01 15.17 14.87
4 13.51 13.60 15.09 13.40 1.27 12.48 12.68 19.47
5 14.92 13.84 13.42 13.42 16.53 1.30 16.37 16.60
6 14.29 13.62 14.66 13.62 14.90 13.70 1.32 14.33
7 14.26 13.42 14.35 13.53 16.89 14.26 17.03 1.36
Is this normal?
It turns out the super slow peer-to-peer is abnormal.
After I disable IOMMU (Intel VT-d) in the BIOS, the problem is gone:
P2P=Enabled Latency (P2P Writes) Matrix (us)
GPU 0 1 2 3 4 5 6 7
0 1.34 1.22 1.68 1.69 1.71 1.70 1.75 1.73
1 1.20 1.38 1.70 1.67 1.71 1.75 1.75 1.72
2 1.69 1.67 1.29 1.20 1.73 1.75 1.75 1.75
3 1.69 1.66 1.17 1.29 1.74 1.75 1.72 1.73
4 1.72 1.76 1.74 1.70 1.32 1.13 1.66 1.70
5 1.74 1.73 1.75 1.74 1.18 1.28 1.67 1.69
6 1.75 1.74 1.74 1.72 1.67 1.68 1.31 1.19
7 1.76 1.75 1.73 1.73 1.67 1.69 1.18 1.32
It seems the problem is the same as or is very similar to discussions in:
https://github.com/pytorch/pytorch/issues/1637
https://github.com/pytorch/pytorch/issues/24081
A few possible solutions are mentioned in the discussions:
Disable IOMMU:
https://github.com/pytorch/pytorch/issues/1637#issuecomment-338268158
https://github.com/pytorch/pytorch/issues/1637#issuecomment-401422046
Disable ACS:
https://github.com/pytorch/pytorch/issues/24081#issuecomment-557074611
https://github.com/pytorch/pytorch/issues/24081#issuecomment-547976127
My system having the problem only had IOMMU enabled in the BIOS. ACS was not turned on as lspci -vvv | grep ACS got back nothing.
==============================
Background on I/O MMU:
https://en.wikipedia.org/wiki/X86_virtualization#I/O_MMU_virtualization_(AMD-Vi_and_Intel_VT-d)
It's part of the x86 virtualization. It's the virtualization done by the chipset. Besides the name IOMMU, it's also called AMD-Vi or Intel VT-d. Not to be confused with AMD-V and Intel VT-x which are virtualization via the CPU.

Sum and Average Data into Table from Seperate Table based on Date Intervals

I have growth data of trees for the month of June across multiple years. Around the beginning of June in 2012, 2013 and 2014, I planted seeds and went back to those seeds near the end of the month to see if the seeds germinated and the tree was alive, or didn't germinate and the tree was dead. For each sample (each seed), the number of growing days were calculated.
Sample_ID Tree_Type Check_Date Growing_Days Status Max_Temp Min_Temp Mean_Temp Total_mm_Rain
1 Spruce 25-06-2012 16 Alive
2 Spruce 28-06-2012 25 Alive
3 Fir 23-06-2012 19 Dead
4 Spruce 29-06-2012 23 Alive
5 Fir 28-06-2012 16 Alive
6 Fir 25-06-2013 18 Alive
7 Fir 26-06-2013 15 Dead
8 Spruce 28-06-2013 17 Alive
9 Fir 30-06-2013 24 Dead
10 Fir 27-06-2013 19 Alive
11 Spruce 21-06-2014 16 Alive
12 Fir 24-06-2014 18 Alive
13 Fir 28-06-2014 14 Dead
14 Spruce 29-06-2014 18 Alive
15 Spruce 30-06-2014 15 Dead
What I would like to is see how weather affected my trees. I have pulled historical weather data as a separate dataframe and would like to add to each sample row the Total_mm_Rain that fell during the growing days, along with Max, Min and Mean Temperatures of that growing period.
Date Max_Temp Min_Temp Mean_Temp Total_mm_Rain
01-05-2012 9 3 6 0
02-05-2012 9 2.5 5.8 0
03-05-2012 9.5 -2.5 3.5 4.6
04-05-2012 11 2.5 6.8 0.6
05-05-2012 10 2 6 1.8
06-05-2012 14 -2 6 0
07-05-2012 18 -2 8 0
08-05-2012 21.5 1 11.3 0
09-05-2012 17.5 4.5 11 2.8
10-05-2012 8 0.5 4.3 0
11-05-2012 14.5 -6 4.3 0
12-05-2012 19.5 -3 8.3 0
13-05-2012 23.5 -1 11.3 0
14-05-2012 25 0.5 12.8 0
15-05-2012 27.5 1.5 14.5 0
16-05-2012 24 2.5 13.3 0
17-05-2012 15.5 4.5 10 10
18-05-2012 12.5 2 7.3 0.4
19-05-2012 15 -2 6.5 0
20-05-2012 17.5 -2 7.8 0.4
21-05-2012 15.5 6.5 11 2.2
22-05-2012 12.5 8 10.3 0.4
23-05-2012 14 5 9.5 9.6
24-05-2012 10 1 5.5 1
25-05-2012 11 3 7 3
26-05-2012 13 2 7.5 0
27-05-2012 11.5 3 7.3 0
28-05-2012 17.5 3 10.3 1.2
29-05-2012 15.5 4 9.8 0.2
30-05-2012 17.6 4 10.8 0
31-05-2012 16 6.5 11.3 0.2
01-05-2013 11.5 -4.9 3.3 0
02-05-2013 17.1 -4.5 6.3 2
03-05-2013 15 5.1 10.1 0
04-05-2013 18.9 -0.2 9.4 0
05-05-2013 24.2 -1.8 11.2 0
06-05-2013 26.6 -0.1 13.3 0
07-05-2013 21.9 1.5 11.7 0
08-05-2013 24.6 4.9 14.8 0
09-05-2013 25.5 0.9 13.2 0
10-05-2013 21.4 2 11.7 0
11-05-2013 26.2 3.9 15.1 0
12-05-2013 25 4.5 14.8 0.2
13-05-2013 19.9 10.2 15.1 11
14-05-2013 13.1 5 9.1 0.2
15-05-2013 17.2 -1.7 7.8 0
16-05-2013 15.3 4.1 9.7 0
17-05-2013 18.6 2.4 10.5 1.6
18-05-2013 15.5 3 9.3 5.6
19-05-2013 12.7 5.6 9.2 1
20-05-2013 22 5 13.5 0
21-05-2013 21.9 1.9 11.9 0
22-05-2013 12 7 9.5 24.8
23-05-2013 7.3 0.1 3.7 4.6
24-05-2013 12.3 1.5 6.9 0.2
25-05-2013 13.7 3.7 8.7 0
26-05-2013 19 -1.5 8.8 0
27-05-2013 20 3.5 11.8 0
28-05-2013 17 5.5 11.3 0
29-05-2013 20.1 7 13.6 0.8
30-05-2013 13.5 7.5 10.5 2.4
31-05-2013 9.9 7 8.5 7.8
01-06-2014 8.8 -1 3.9 3.6
02-06-2014 11.4 0.5 6 0
03-06-2014 11.6 -0.7 5.5 0
04-06-2014 16.9 -3.6 6.7 0
05-06-2014 19.6 -2.3 8.7 0
06-06-2014 16.7 0.9 8.8 0
07-06-2014 9.3 5 7.2 1
08-06-2014 10.1 2.8 6.5 0.4
09-06-2014 13.3 -5.2 4.1 0
10-06-2014 16 -4.3 5.9 0
11-06-2014 17 -1.5 7.8 1.6
12-06-2014 13.9 4.7 9.3 0.3
13-06-2014 16.5 -3.4 6.6 0
14-06-2014 22.9 -2.3 10.3 0
15-06-2014 27 0.6 13.8 0
16-06-2014 29.6 4.1 16.9 0
17-06-2014 29.1 3.3 16.2 0
18-06-2014 28.1 5.6 16.9 0
19-06-2014 25.9 8.1 17 0.2
20-06-2014 15.9 8.7 12.3 3.1
21-06-2014 21.3 8.8 15.1 0.4
22-06-2014 23.7 6.7 15.2 6.9
23-06-2014 18.4 9.3 13.9 0
24-06-2014 18.2 4 11.1 6.4
25-06-2014 16 6.5 11.3 10
26-06-2014 12.2 3.6 7.9 1.9
27-06-2014 11.6 3.5 7.6 2.6
28-06-2014 13.7 4.4 9.1 5.6
29-06-2014 11.7 5.5 8.6 3.4
30-06-2014 17.4 7 12.2 0
I have tried using table functions as well as diving into the idea of converting dates to numbers (as in excel) and summing based on dates as numbers instead of dates, but this is above my knowledge of R.

Extrapolation command in Octave

I want to do interpolation and extrapolation. I can interpolate by using interp2 command. But, this command didn't perform extrapolation. Is there any built-in function for extrapolation in octave? I have given an example in detail.
a= [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17];
b= [ 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011];
c= [ -0.88 -8.87 -0.86 -0.82 -0.77 -0.71 -0.66 -0.62 -0.57 -0.54 -0.50 -0.47 -0.44 -0.42 -0.39 -0.377 -0.36 -0.89 -0.88 -0.85 -0.81 -0.76 -0.71 -0.66 -0.61 -0.57 -0.53 -0.50 -0.47 -0.44 -0.42 -0.39 -0.37 -0.36];
cc = repmat(c,34,1);
ci= interp2(a, b, cc, 1.5, 0.0015) % Interpolation at some point
ai= [ 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5 11 11.5 12 12.5 13 13.5 14 14.5 15 15.5 16 16.5 17 17.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5 11 11.5 12 12.5 13 13.5 14 14.5 15 15.5 16 16.5 17 17.5];
bi= [ 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011];
cim= interp2(a, b, cc, ai, bi) % Interpolation matrix
ce= interp2(a, b, cc, 18, 0.2) % Extrapolation at some point
ae= 4* [ 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5 11 11.5 12 12.5 13 13.5 14 14.5 15 15.5 16 16.5 17 17.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5 11 11.5 12 12.5 13 13.5 14 14.5 15 15.5 16 16.5 17 17.5];
be= [ 0.101 0.101 0.101 0.101 0.101 0.101 0.101 0.101 0.101 0.101 0.101 0.101 0.101 0.101 0.101 0.101 0.101 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1015 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.1017 0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111];
cem= interp2(a, b, cc, ae, be) % Extrapolation matrix
How can I find ce and cem in this case? Here, it gives "NA". How should I extrapolate to find ce and cem? This code works in Octave only.
Thanks in advance
Sarah
The most similar command for data outside convex hull in octave to scatteredInterpolant of Matlab is griddata. For more information about griddata, griddata3 and griddatan read octave documentation.