Skip to content

Commit e6de5aa

Browse files
authored
Merge pull request #300 from deephealthproject/develop
Fixes for v1.0
2 parents 76becab + 99aa78f commit e6de5aa

File tree

72 files changed

+2315
-487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2315
-487
lines changed

Jenkinsfile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ pipeline {
1515
steps {
1616
timeout(60) {
1717
echo 'Building..'
18-
cmakeBuild buildDir: 'build', cmakeArgs: '-DBUILD_TARGET=CPU -DBUILD_SUPERBUILD=ON -DBUILD_TESTS=ON', installation: 'InSearchPath', sourceDir: '.', cleanBuild: true, steps: [[withCmake: true]]
18+
cmakeBuild buildDir: 'build', buildType: 'Release', cmakeArgs: '-DBUILD_TARGET=CPU -DBUILD_SUPERBUILD=ON -DBUILD_TESTS=ON', installation: 'InSearchPath', sourceDir: '.', cleanBuild: true, steps: [
19+
[args: '--parallel 4', withCmake: true]
20+
]
1921
}
2022
}
2123
}
2224
stage('Test') {
2325
steps {
2426
timeout(15) {
2527
echo 'Testing..'
26-
ctest arguments: '-C Debug -VV', installation: 'InSearchPath', workingDir: 'build'
28+
ctest arguments: '-C Release -VV', installation: 'InSearchPath', workingDir: 'build'
2729
}
2830
}
2931
}
@@ -43,15 +45,17 @@ pipeline {
4345
steps {
4446
timeout(60) {
4547
echo 'Building..'
46-
cmakeBuild buildDir: 'build', cmakeArgs: '-DBUILD_TARGET=CPU -DBUILD_SHARED_LIBS=OFF -DBUILD_SUPERBUILD=ON -DBUILD_TESTS=ON', installation: 'InSearchPath', sourceDir: '.', cleanBuild: true, steps: [[withCmake: true]]
48+
cmakeBuild buildDir: 'build', buildType: 'Release', cmakeArgs: '-DBUILD_TARGET=CPU -DBUILD_SHARED_LIBS=OFF -DBUILD_SUPERBUILD=ON -DBUILD_TESTS=ON', installation: 'InSearchPath', sourceDir: '.', cleanBuild: true, steps: [
49+
[args: '--config Release --parallel 4', withCmake: true]
50+
]
4751
}
4852
}
4953
}
5054
stage('Test') {
5155
steps {
5256
timeout(15) {
5357
echo 'Testing..'
54-
bat 'cd build && ctest -C Debug -VV'
58+
bat 'cd build && ctest -C Release -VV'
5559
}
5660
}
5761
}
@@ -75,15 +79,17 @@ pipeline {
7579
steps {
7680
timeout(60) {
7781
echo 'Building..'
78-
cmakeBuild buildDir: 'build', cmakeArgs: '-DBUILD_TARGET=GPU -DBUILD_TESTS=ON -DBUILD_SUPERBUILD=ON', installation: 'InSearchPath', sourceDir: '.', cleanBuild: true, steps: [[withCmake: true]]
82+
cmakeBuild buildDir: 'build', buildType: 'Release', cmakeArgs: '-DBUILD_TARGET=GPU -DBUILD_TESTS=ON -DBUILD_SUPERBUILD=ON', installation: 'InSearchPath', sourceDir: '.', cleanBuild: true, steps: [
83+
[args: '--parallel 4', withCmake: true]
84+
]
7985
}
8086
}
8187
}
8288
stage('Test') {
8389
steps {
8490
timeout(15) {
8591
echo 'Testing..'
86-
ctest arguments: '-C Debug -VV', installation: 'InSearchPath', workingDir: 'build'
92+
ctest arguments: '-C Release -VV', installation: 'InSearchPath', workingDir: 'build'
8793
}
8894
}
8995
}
@@ -103,15 +109,17 @@ pipeline {
103109
steps {
104110
timeout(60) {
105111
echo 'Building..'
106-
cmakeBuild buildDir: 'build', cmakeArgs: '-DBUILD_TARGET=GPU -DBUILD_TESTS=ON -DBUILD_SUPERBUILD=ON', installation: 'InSearchPath', sourceDir: '.', cleanBuild: true, steps: [[withCmake: true]]
112+
cmakeBuild buildDir: 'build', buildType: 'Release', cmakeArgs: '-DBUILD_TARGET=GPU -DBUILD_TESTS=ON -DBUILD_SUPERBUILD=ON', installation: 'InSearchPath', sourceDir: '.', cleanBuild: true, steps: [
113+
[args: '--config Release --parallel 4', withCmake: true]
114+
]
107115
}
108116
}
109117
}
110118
stage('Test') {
111119
steps {
112120
timeout(15) {
113121
echo 'Testing..'
114-
bat 'cd build && ctest -C Debug -VV'
122+
bat 'cd build && ctest -C Release -VV'
115123
}
116124
}
117125
}

cmake/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ else()
125125
set(Protobuf_ROOT "${EP_BASE_DIR}/protobuf" PARENT_SCOPE)
126126
set(Protobuf_INCLUDE_DIRS "${EP_BASE_DIR}/protobuf/include" PARENT_SCOPE)
127127
set(Protobuf_PROTOC_EXECUTABLE "${EP_BASE_DIR}/protobuf/bin/protoc" PARENT_SCOPE)
128+
set(Protobuf_USE_STATIC_LIBS ON PARENT_SCOPE) # Always static when superbuild is enabled
128129
endif()
129130
add_custom_target(protobuf_files
130131
protoc --cpp_out=../src/serialization/onnx ../src/serialization/onnx/onnx.proto

docs/markdown/eddl_progress.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
| Split | 🟢️️| 🟢️️ |🟢️️ | 🟢️ | Split a layer into a list of tensors layers |
2727
| Embedding | 🟢️️ | 🟢️️ | 🟢️️ | ️🟢️️ | Turns positive integers (indexes) into dense vectors of fixed size; (also known as mapping). e.g. `[[4], [20]] -> [[0.25, 0.1], [0.6, -0.2]]` |
2828
| Transpose | 🟢️️ | 🟢️️ | 🟢️️ | ️🟢️️ | Permute the last two dimensions |
29-
| ConstOfTensor | 🟢️️ | 🟢️️ | 🟢️️ | ️🟢️️ | Repeats a tensor across the batch |
30-
| Equal | 🟢️️ | 🟢️️ | 🟢️️ |🟢️️ | Return (x1 == x2) element-wise |
29+
| ConstOfTensor | 🟢️️ | 🟢️️ | 🟢️️ | 🟢️ | Repeats a tensor across the batch |
30+
| Equal | 🟢️️ | 🟢️️ | 🟢️️ |🔴️ | Return (x1 == x2) element-wise |
3131
| Expand | 🟢️️| 🟢️️ |🟢️️ | 🟢️ | Returns a layer with singleton dimensions expanded to a larger size |
32-
| Where | 🟢️️ | 🟢️️ | 🟢️️ |🟢️️ | Return elements chosen from x or y depending on condition |
32+
| Where | 🟢️️ | 🟢️️ | 🟢️️ |🔴️ | Return elements chosen from x or y depending on condition |
3333
| Resize | 🟢️️ | 🟢️️ |🟢️️ | 🟢️️ | Resize the input image to the given size. `[height, width]` |
3434

3535

@@ -64,10 +64,10 @@
6464
| Conv3D | ⚫️️ | ⚫️ |🟢️️ | 🟢️ | 3D convolution |
6565
| Pointwise | 🟢️️ | 🟢️️ |🟢️️ | 🟢️️ | 2D pointwise convolution |
6666
| DepthwiseConv2D | 🔴️ | 🔴️ |🔴️ | 🔴️ | 2D depthsise convolution |
67-
| TransposedConv2D | ⚫️️ | ⚫️ |🟢️| 🔴️️ | 2D Transposed convolution |
68-
| TransposedConv3D | ⚫️️ | ⚫️ |🟢️| 🔴| 3D Transposed convolution |
67+
| TransposedConv2D | ⚫️️ | ⚫️ |🟢️| 🟢️ | 2D Transposed convolution |
68+
| TransposedConv3D | ⚫️️ | ⚫️ |🟢️| 🟢| 3D Transposed convolution |
6969
| UpSampling2D | 🟢️️ | 🟢️️ |🟢️️ | 🟢️️ | Practically the same as `Scale(mode="nearest")`. Instead of performing nearest interpolation, this works by repeating n times the elements of each axis `[2, 1] => [2, 2, 1, 1]` |
70-
| UpSampling3D | 🟢️️ | 🟢️️ |🟢️️ | ️️🔴 | Practically the same as `Scale(mode="nearest")`. Instead of performing nearest interpolation, this works by repeating n times the elements of each axis `[2, 1] => [2, 2, 1, 1]` |
70+
| UpSampling3D | 🟢️️ | 🟢️️ | 🟢️️ | ️️🟢️️ | Practically the same as `Scale(mode="nearest")`. Instead of performing nearest interpolation, this works by repeating n times the elements of each axis `[2, 1] => [2, 2, 1, 1]` |
7171

7272

7373
## Data transformation/augmentation
@@ -86,7 +86,7 @@ Deterministic transformations
8686
| Flip | 🟢️️ | 🟢️️ |🟢️️ | ⚫️ | Flip the given image at `axis=n` |
8787
| Grayscale | ⚫️ | ⚫️ |⚫️ | ⚫️️ | Convert image to grayscale |
8888
| HorizontalFlip | 🟢️️ | 🟢️️ |🟢️️ | ⚫️ | Horizontally flip the given image |
89-
| Pad | 🟢️️ | 🟢️️ |🟢️️| | Pad the given image on all sides with the given "pad" value |
89+
| Pad | 🟢️️ | 🟢️️ |🟢️️| 🟢| Pad the given image on all sides with the given "pad" value |
9090
| Rotate | 🟢️️ | 🟢️️ |🟢️️ | ⚫️ | Rotate the image by angle |
9191
| Scale | 🟢️️ | 🟢️️ |🟢️️ | 🟢️️ | Resize the input image to the given size. `[height, width]`. Does not include backward (see Resize) |
9292
| Shift | 🟢️️ | 🟢️️ |🟢️️ | ⚫️ | Shift the input image `[a, b]` |
@@ -253,7 +253,7 @@ Apply data transformations with random parametrization.
253253
| MSLE | ⚫️ | ⚫️️ | Mean Squared Logarithmic Error |
254254
| Min | 🟢️️ | 🟢️️ | 🟢️️ | Minimum Error |
255255
| Hinge |||| Hinge Error |
256-
| Dice | 🟢️️ | 🟢️️ 🟢️️ | Dice loss |
256+
| Dice | 🟢️️ | 🟢️️ | 🟢️️ | Dice loss |
257257
| SoftCrossEntropy | 🟢️️ | 🟢️️ | 🟢️️ | Soft-Categorical Cross-Entropy Error |
258258

259259

docs/sphinx/source/intro/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ You can also install ``EDDL`` from source with cmake.
159159
# Build and install
160160
mkdir build
161161
cd build
162-
cmake .. -DCMAKE_PREFIX_PATH=$CONDA_PREFIX -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
162+
cmake .. -DCMAKE_PREFIX_PATH=%CONDA_PREFIX% -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%
163163
164-
make install
164+
cmake --build . --target install
165165
166166
See the :doc:`build-options` section for more details about cmake options.
167167

docs/sphinx/source/layers/rnn.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ GRU
2020

2121
Gated Recurrent Unit - Cho et al. 2014.
2222

23-
.. note::
23+
.. doxygenfunction:: GRU(layer parent, int units, bool mask_zeros=false, bool bidirectional = false, string name = "")
2424

25-
**Not implemented yet**
2625

27-
Check development progress in https://github.com/deephealthproject/eddl/blob/master/docs/markdown/eddl_progress.md#core-layers
26+
Example:
27+
28+
.. code-block:: c++
29+
30+
l = GRU(l, 128);
2831

2932

3033

docs/sphinx/source/models_zoo/classification.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,35 @@ Example:
1414
Net* net = download_vgg16(false); // With dense part
1515
Net* net = download_vgg16(true, {3, 64, 64}); // With new input shape
1616

17+
.. doxygenfunction:: eddl::download_vgg16_bn
18+
19+
Example:
20+
21+
.. code-block:: c++
22+
23+
Net* net = download_vgg16_bn(); // Only convolutional part
24+
Net* net = download_vgg16_bn(false); // With dense part
25+
Net* net = download_vgg16_bn(true, {3, 64, 64}); // With new input shape
26+
27+
.. doxygenfunction:: eddl::download_vgg19
28+
29+
Example:
30+
31+
.. code-block:: c++
32+
33+
Net* net = download_vgg19(); // Only convolutional part
34+
Net* net = download_vgg19(false); // With dense part
35+
Net* net = download_vgg19(true, {3, 64, 64}); // With new input shape
36+
37+
.. doxygenfunction:: eddl::download_vgg19_bn
38+
39+
Example:
40+
41+
.. code-block:: c++
42+
43+
Net* net = download_vgg19_bn(); // Only convolutional part
44+
Net* net = download_vgg19_bn(false); // With dense part
45+
Net* net = download_vgg19_bn(true, {3, 64, 64}); // With new input shape
1746

1847
ResNet
1948
-------

docs/sphinx/source/test_score/test_score.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,14 @@ Example:
1212
.. code-block:: c++
1313

1414
evaluate(mymodel, {X_test}, {Y_test});
15+
16+
Make predictions
17+
----------------
18+
19+
.. doxygenfunction:: eddl::predict
20+
21+
Example:
22+
23+
.. code-block:: c++
24+
25+
preds = predict(mymodel, {X_test});

environment.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ channels:
33
- conda-forge
44
- defaults
55
- anaconda
6+
- menpo
67
dependencies:
78
- cmake>=3.17.2
89
- eigen==3.3.7
@@ -11,8 +12,8 @@ dependencies:
1112
- zlib==1.2.11
1213
- openssl==1.1.1i
1314
- gtest==1.10.0
14-
- graphviz==2.42.3 # Build & Run
15-
- wget==1.20.1
15+
- graphviz==2.42.3|2.47.2 # Build & Run
16+
- wget==1.20.1|1.16.3
1617
- doxygen==1.9.1 # Docs
1718
- python==3.8.6
1819
- pip==21.0.1

examples/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,14 @@ if(BUILD_PROTOBUF)
124124
add_executable(test_onnx_conv3D "test_internals/onnx/test_onnx_conv3D.cpp")
125125
target_link_libraries(test_onnx_conv3D eddl)
126126

127-
add_executable(test_onnx_convT2D "test_internals/onnx/test_onnx_convT2D.cpp")
127+
add_executable(test_onnx_dilated_conv1D "test_internals/onnx/test_onnx_dilated_conv1D.cpp")
128+
target_link_libraries(test_onnx_dilated_conv1D eddl)
129+
add_executable(test_onnx_dilated_conv2D "test_internals/onnx/test_onnx_dilated_conv2D.cpp")
130+
target_link_libraries(test_onnx_dilated_conv2D eddl)
131+
add_executable(test_onnx_dilated_conv3D "test_internals/onnx/test_onnx_dilated_conv3D.cpp")
132+
target_link_libraries(test_onnx_dilated_conv3D eddl)
133+
134+
add_executable(test_onnx_convT2D "test_internals/onnx/test_onnx_convT2D.cpp")
128135
target_link_libraries(test_onnx_convT2D eddl)
129136
add_executable(test_onnx_convT3D "test_internals/onnx/test_onnx_convT3D.cpp")
130137
target_link_libraries(test_onnx_convT3D eddl)

examples/onnx/1_onnx_pointer.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ int main(int argc, char **argv) {
7171
{"categorical_accuracy"}, // Metrics
7272
//CS_GPU({1}) // one GPU
7373
CS_CPU(4), // CPU with maximum threads availables
74-
true
74+
true // initialize weights randomly
7575
);
7676

7777
void* serialized_net;
78-
size_t model_size = serialize_net_to_onnx_pointer(net, serialized_net, false );
78+
size_t model_size = serialize_net_to_onnx_pointer(net, serialized_net, false ); // serialize weights
7979

8080
// View model
8181
summary(net);
@@ -116,13 +116,13 @@ int main(int argc, char **argv) {
116116
// Export
117117
//save_net_to_onnx_file(net, path);
118118
void* serialized_gradients;
119-
size_t gradients_size = serialize_net_to_onnx_pointer(net, serialized_gradients, true );
119+
size_t gradients_size = serialize_net_to_onnx_pointer(net, serialized_gradients, true ); // serialize gradients
120120
//std::string* model_string = serialize_net_to_onnx_string(net);
121121

122122
cout << "Exported gradients" << endl;
123123

124124
void * serialized_net_once_trained;
125-
size_t snot_size = serialize_net_to_onnx_pointer( net, serialized_net_once_trained, false );
125+
size_t snot_size = serialize_net_to_onnx_pointer( net, serialized_net_once_trained, false ); // serialize weights
126126

127127

128128

@@ -160,7 +160,7 @@ int main(int argc, char **argv) {
160160
{"categorical_accuracy"}, // Metrics
161161
//CS_GPU({1}) // one GPU
162162
CS_CPU(4), // CPU with maximum threads availables
163-
false
163+
false // not to initialize weights
164164
);
165165

166166
//resize_model(imported_net, batch_size);
@@ -230,6 +230,8 @@ int main(int argc, char **argv) {
230230
cout << "Evaluating test after new weights" << endl;
231231
evaluate(imported_net, {x_test}, {y_test});
232232

233+
net->reset_accumulated_gradients();
234+
233235
for( int k=0; k < 10; k++ ) {
234236
// Train
235237
if (testing)

0 commit comments

Comments
 (0)