← 开源
100

Cranium

🤖 A portable, header-only, artificial neural network library written in C99

Model DevelopmentDeep Learning FrameworksC
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
600
Star
56
Fork
+0
本周
2
贡献者
创建于 2016-12-25 · 更新于 2026-10-13 · 今日第 16293 名
主要开发者
100bedder

100/Cranium 排名第 16,293,有 600 个星标。

同类别比较

100/Cranium 排名第 16,293,此处有 8 个同类条目;xg-chu/GAGAvatar 排名第 16,292。

同类别比较
名称排名指标
isarandi/metrabs16,283
语言:
Python
星标数:
601
分叉数:
86
简介:
Estimate absolute 3D human poses from RGB images.
isht7/pytorch-deeplab-resnet16,284
语言:
Python
星标数:
601
分叉数:
115
简介:
DeepLab resnet v2 model in pytorch
thousandbrainsproject/tbp.monty16,291
语言:
Python
星标数:
601
分叉数:
351
简介:
Monty is a sensorimotor learning framework based on the thousand brains theory of the neocortex.
xg-chu/GAGAvatar16,292
语言:
Python
星标数:
601
分叉数:
60
简介:
[NeurIPS 2024] Generalizable and Animatable Gaussian Head Avatar
HarryVolek/PyTorch_Speaker_Verification16,295
语言:
Python
星标数:
600
分叉数:
163
简介:
PyTorch implementation of "Generalized End-to-End Loss for Speaker Verification" by Wan, Li et al.
JiahuiYu/wdsr_ntire201816,296
语言:
Python
星标数:
600
分叉数:
119
简介:
Code of our winning entry to NTIRE super-resolution challenge, CVPR 2018
RaphaelMeudec/deblur-gan16,297
语言:
Python
星标数:
600
分叉数:
247
简介:
Keras implementation of "DeblurGAN: Blind Motion Deblurring Using Conditional Adversarial Networks"
jostmey/rwa16,301
语言:
Python
星标数:
600
分叉数:
60
简介:
Machine Learning on Sequential Data Using a Recurrent Weighted Average
关键参数与规格
关键参数与规格
参数值
语言C
类别Model Development
子类别Deep Learning Frameworks
星标数600
分叉数56
贡献者2
创建日期2016-12-25
更新日期2026-10-13
1 天星标数0
7 天星标数0
排名16,293
上次排名16,083
排名变化-210
7 天星标排名15,453
上次 7 天星标排名15,463
7 天星标排名变化10
总星标排名16,781
上次总星标排名16,757
总星标排名变化-24
国家USA
README 摘录

*Cranium* is a portable, header-only, feedforward artificial neural network library written in vanilla C99. It supports fully-connected networks of arbitrary depth and structure, and should be reasonably fast as it uses a matrix-based approach to calculations. It is particularly suitable for low-resource machines or environments in which additional dependencies cannot be installed. Simply uncomment line 7 in to enable the BLAS function for fast matrix multiplication. Check out the detailed documentation here for information on individual

structures and functions. Features **Activation functions** **Loss functions** **Optimization algorithms** **L2 Regularization** **Learning rate annealing** **Simple momentum** **Fan-in weight initialization** **CBLAS support for fast matrix multiplication** **Serializable networks** Usage Since Cranium is header-only, simply copy the directory into your project, and to begin using it. Its only required compiler dependency is from the header, so compile with . If you are using CBLAS, you will also need to compile with and include, via , the path to wherever your particular

machine's BLAS implementation is. It has been tested to work perfectly fine with any level of gcc optimization, so feel free to use them. Example Building and Testing To run tests, look in the folder. The has commands to run each batch of unit tests, or all of them at once. Contributing Feel free to send a pull request if you want to add any features or if you find a bug. Check the issues tab for some potential things

to do.

常见问题

记录了多少星标和分叉?

100/Cranium 有 600 个星标和 56 个分叉。

仓库排名是多少?

100/Cranium 排名第 16,293。

记录的语言和类别是什么?

100/Cranium 有 600 个星标,语言为 C,类别为 Model Development。

哪个仓库排名最接近?

100/Cranium 与 xg-chu/GAGAvatar 比较,后者排名第 16,292,有 601 个星标。

README
 ![](docs/image.png) 

Cranium is a portable, header-only, feedforward artificial neural network library written in vanilla C99.

It supports fully-connected networks of arbitrary depth and structure, and should be reasonably fast as it uses a matrix-based approach to calculations. It is particularly suitable for low-resource machines or environments in which additional dependencies cannot be installed.

Cranium supports CBLAS integration. Simply uncomment line 7 in matrix.h to enable the BLAS sgemm function for fast matrix multiplication.

Check out the detailed documentation here for information on individual structures and functions.

Features

  • Activation functions
    • sigmoid
    • ReLU
    • tanh
    • softmax (classification)
    • linear (regression)
  • Loss functions
    • Cross-entropy loss (classification)
    • Mean squared error (regression)
  • Optimization algorithms
    • Batch Gradient Descent
    • Stochastic Gradient Descent
    • Mini-Batch Stochastic Gradient Descent
  • L2 Regularization
  • Learning rate annealing
  • Simple momentum
  • Fan-in weight initialization
  • CBLAS support for fast matrix multiplication
  • Serializable networks

Usage

Since Cranium is header-only, simply copy the src directory into your project, and #include "src/cranium.h" to begin using it.

Its only required compiler dependency is from the `````` header, so compile with -lm.

If you are using CBLAS, you will also need to compile with -lcblas and include, via -I, the path to wherever your particular machine's BLAS implementation is. Common ones include OpenBLAS and ATLAS.

It has been tested to work perfectly fine with any level of gcc optimization, so feel free to use them.

Example

#include "cranium.h"

/*
This basic example program is the skeleton of a classification problem.
The training data should be in matrix form, where each row is a data point, and
    each column is a feature. 
The training classes should be in matrix form, where the ith row corresponds to
    the ith training example, and each column is a 1 if it is of that class, and
    0 otherwise. Each example may only be of 1 class.
*/

// create training data and target values (data collection not shown)
int rows, features, classes;
float** training;
float** classes;

// create datasets to hold the data
DataSet* trainingData = createDataSet(rows, features, training);
DataSet* trainingClasses = createDataSet(rows, classes, classes);

// create network with 2 input neurons, 1 hidden layer with sigmoid
// activation function and 5 neurons, and 2 output neurons with softmax 
// activation function
srand(time(NULL));
size_t hiddenSize[] = {5};
Activation hiddenActivation[] = {sigmoid};
Network* net = createNetwork(2, 1, hiddenSize, hiddenActivation, 2, softmax);

// train network with cross-entropy loss using Mini-Batch SGD
ParameterSet params;
params.network = net;
params.data = trainingData;
params.classes = trainingClasses;
params.lossFunction = CROSS_ENTROPY_LOSS;
params.batchSize = 20;
params.learningRate = .01;
params.searchTime = 5000;
params.regularizationStrength = .001;
params.momentumFactor = .9;
params.maxIters = 10000;
params.shuffle = 1;
params.verbose = 1;
optimize(params);

// test accuracy of network after training
printf("Accuracy is %f\n", accuracy(net, trainingData, trainingClasses));

// get network's predictions on input data after training
forwardPass(net, trainingData);
int* predictions = predict(net);
free(predictions);

// save network to a file
saveNetwork(net, "network");

// free network and data
destroyNetwork(net);
destroyDataSet(trainingData);
destroyDataSet(trainingClasses);

// load previous network from file
Network* previousNet = readNetwork("network");
destroyNetwork(previousNet);

Building and Testing

To run tests, look in the tests folder.

The Makefile has commands to run each batch of unit tests, or all of them at once.

Contributing

Feel free to send a pull request if you want to add any features or if you find a bug.

Check the issues tab for some potential things to do.

排名相邻
同类项目