Function
Static Public Summary | ||
public |
arrContains(array: Array, element: undefined): boolean Check if an |
|
public |
Creates a duplicate-free version of an array |
|
public |
Check the given |
|
public |
Data augmentation to the given |
|
public |
Return a number by following Gaussian distribution by using Box-Muller Transform |
|
public |
Return the given |
|
public |
img_to_vol(img: HTMLImageElement, grayScale: boolean): Vol Load an HTML DOM image to a virtual canvas and get the pixles data. |
|
public |
Return the max/min information of a given value list. |
|
public |
Return a random float number between |
|
public |
Return a random integer number between |
|
public |
Return a random number based on the given |
|
public |
Generate a incrementing number list between 0 and |
|
public |
Return a zero based number list by given size |
|
public |
weightedSample(array: Array, probabilities: Array): * Return a sample of the given |
|
public |
zeros(n: number): Float64Array Return a series of 0 |
Static Public
public arrContains(array: Array, element: undefined): boolean source
import {arrContains} from 'convnet-sourcecode/src/utils.ts'
Check if an element
exists in given array
or not
public arrUnique(array: Array): Array source
import {arrUnique} from 'convnet-sourcecode/src/utils.ts'
Creates a duplicate-free version of an array
Params:
Name | Type | Attribute | Description |
array | Array |
public assert(condition: boolean, message: undefined) source
import {assert} from 'convnet-sourcecode/src/utils.ts'
Check the given condition
, if false
, throw exception with the given message
public augment(volume: Vol, crop: number, dx: number, dy: number, flip: number): Vol source
import {augment} from 'convnet-sourcecode/src/convnet_vol_util.ts'
Data augmentation to the given volume
based on crop
.
crop
is the size of outputdx
,dy
are offset wrt incoming volume, of the shiftflip
is boolean on whether we also want to flip the matrix between left and right horizontally
public gaussRandom(): number source
import {gaussRandom} from 'convnet-sourcecode/src/utils.ts'
Return a number by following Gaussian distribution by using Box-Muller Transform
public getopt(dict: Array, key: undefined, defaultValue: undefined): * source
import {getopt} from 'convnet-sourcecode/src/utils.ts'
Return the given dict
value by key
.
- If
key
is astring
, return the value ofdict[key]
if exists, otherwise return thedefaultValue
- If
key
is anarray
, use the last item of this array askey
to query the value indict
Return:
* |
public img_to_vol(img: HTMLImageElement, grayScale: boolean): Vol source
import {img_to_vol} from 'convnet-sourcecode/src/convnet_vol_util.ts'
Load an HTML DOM image to a virtual canvas and get the pixles data. Then return a volume
based on the image data
- If
grayScale
is given, the depth of thevolume
is 1 - If
grayScale
is not given, the depth of thevolume
is 4 (RGBA)
Params:
Name | Type | Attribute | Description |
img | HTMLImageElement | ||
grayScale | boolean |
public maxmin(values: undefined): {"maxi": *, "maxv": *, "mini": *, "minv": *, "dv": *} source
import {maxmin} from 'convnet-sourcecode/src/utils.ts'
Return the max/min information of a given value list.
Params:
Name | Type | Attribute | Description |
values | undefined |
Return:
{"maxi": *, "maxv": *, "mini": *, "minv": *, "dv": *} |
public randf(a: number, b: number): number source
import {randf} from 'convnet-sourcecode/src/utils.ts'
Return a random float number between a
and b
public randi(a: number, b: number): number source
import {randi} from 'convnet-sourcecode/src/utils.ts'
Return a random integer number between a
and b
public randn(mean: number, std: number): number source
import {randn} from 'convnet-sourcecode/src/utils.ts'
Return a random number based on the given mean
and standard deviation
by following Gaussian distribution
public randperm(n: number): Array source
import {randperm} from 'convnet-sourcecode/src/utils.ts'
Generate a incrementing number list between 0 and n
, shffle the list and return it as the result
Params:
Name | Type | Attribute | Description |
n | number |
public range(n: number): * source
import {range} from 'convnet-sourcecode/src/utils.ts'
Return a zero based number list by given size n
Params:
Name | Type | Attribute | Description |
n | number |
Return:
* |
public weightedSample(array: Array, probabilities: Array): * source
import {weightedSample} from 'convnet-sourcecode/src/utils.ts'
Return a sample of the given array
by given probabilities
Return:
* |
public zeros(n: number): Float64Array source
import {zeros} from 'convnet-sourcecode/src/utils.ts'
Return a series of 0
Params:
Name | Type | Attribute | Description |
n | number |