minor spelling fixes (#8830)

* minor spelling fixes
* fix spacing
* bump stb to latest and greatest
This commit is contained in:
Stefano Sinigardi 2023-08-25 16:47:31 +02:00 committed by GitHub
parent 6a9dc6a6f8
commit d47d72cb70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 899 additions and 521 deletions

View File

@ -5,6 +5,7 @@ on:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* stb_image_write - v1.14 - public domain - http://nothings.org/stb
/* stb_image_write - v1.16 - public domain - http://nothings.org/stb
writes out PNG/BMP/TGA/JPEG/HDR images to C stdio - Sean Barrett 2010-2015
no warranty implied; use at your own risk
@ -140,6 +140,7 @@ CREDITS:
Ivan Tikhonov
github:ignotion
Adam Schackart
Andrew Kensler
LICENSE
@ -166,9 +167,9 @@ LICENSE
#endif
#ifndef STB_IMAGE_WRITE_STATIC // C++ forbids static forward declarations
extern int stbi_write_tga_with_rle;
extern int stbi_write_png_compression_level;
extern int stbi_write_force_png_filter;
STBIWDEF int stbi_write_tga_with_rle;
STBIWDEF int stbi_write_png_compression_level;
STBIWDEF int stbi_write_force_png_filter;
#endif
#ifndef STBI_WRITE_NO_STDIO
@ -178,7 +179,7 @@ STBIWDEF int stbi_write_tga(char const *filename, int w, int h, int comp, const
STBIWDEF int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data);
STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality);
#ifdef STBI_WINDOWS_UTF8
#ifdef STBIW_WINDOWS_UTF8
STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input);
#endif
#endif
@ -267,6 +268,8 @@ typedef struct
{
stbi_write_func *func;
void *context;
unsigned char buffer[64];
int buf_used;
} stbi__write_context;
// initialize a callback-based context
@ -283,7 +286,7 @@ static void stbi__stdio_write(void *context, void *data, int size)
fwrite(data,1,size,(FILE*) context);
}
#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8)
#if defined(_WIN32) && defined(STBIW_WINDOWS_UTF8)
#ifdef __cplusplus
#define STBIW_EXTERN extern "C"
#else
@ -294,25 +297,25 @@ STBIW_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned in
STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input)
{
return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL);
return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL);
}
#endif
static FILE *stbiw__fopen(char const *filename, char const *mode)
{
FILE *f;
#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8)
#if defined(_WIN32) && defined(STBIW_WINDOWS_UTF8)
wchar_t wMode[64];
wchar_t wFilename[1024];
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)))
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)/sizeof(*wFilename)))
return 0;
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)))
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)/sizeof(*wMode)))
return 0;
#if _MSC_VER >= 1400
if (0 != _wfopen_s(&f, wFilename, wMode))
f = 0;
#if defined(_MSC_VER) && _MSC_VER >= 1400
if (0 != _wfopen_s(&f, wFilename, wMode))
f = 0;
#else
f = _wfopen(wFilename, wMode);
#endif
@ -380,16 +383,36 @@ static void stbiw__writef(stbi__write_context *s, const char *fmt, ...)
va_end(v);
}
static void stbiw__write_flush(stbi__write_context *s)
{
if (s->buf_used) {
s->func(s->context, &s->buffer, s->buf_used);
s->buf_used = 0;
}
}
static void stbiw__putc(stbi__write_context *s, unsigned char c)
{
s->func(s->context, &c, 1);
}
static void stbiw__write1(stbi__write_context *s, unsigned char a)
{
if ((size_t)s->buf_used + 1 > sizeof(s->buffer))
stbiw__write_flush(s);
s->buffer[s->buf_used++] = a;
}
static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c)
{
unsigned char arr[3];
arr[0] = a; arr[1] = b; arr[2] = c;
s->func(s->context, arr, 3);
int n;
if ((size_t)s->buf_used + 3 > sizeof(s->buffer))
stbiw__write_flush(s);
n = s->buf_used;
s->buf_used = n+3;
s->buffer[n+0] = a;
s->buffer[n+1] = b;
s->buffer[n+2] = c;
}
static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, int write_alpha, int expand_mono, unsigned char *d)
@ -398,7 +421,7 @@ static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, in
int k;
if (write_alpha < 0)
s->func(s->context, &d[comp - 1], 1);
stbiw__write1(s, d[comp - 1]);
switch (comp) {
case 2: // 2 pixels = mono + alpha, alpha is written separately, so same as 1-channel case
@ -406,7 +429,7 @@ static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, in
if (expand_mono)
stbiw__write3(s, d[0], d[0], d[0]); // monochrome bmp
else
s->func(s->context, d, 1); // monochrome TGA
stbiw__write1(s, d[0]); // monochrome TGA
break;
case 4:
if (!write_alpha) {
@ -422,7 +445,7 @@ static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, in
break;
}
if (write_alpha > 0)
s->func(s->context, &d[comp - 1], 1);
stbiw__write1(s, d[comp - 1]);
}
static void stbiw__write_pixels(stbi__write_context *s, int rgb_dir, int vdir, int x, int y, int comp, void *data, int write_alpha, int scanline_pad, int expand_mono)
@ -447,6 +470,7 @@ static void stbiw__write_pixels(stbi__write_context *s, int rgb_dir, int vdir, i
unsigned char *d = (unsigned char *) data + (j*x+i)*comp;
stbiw__write_pixel(s, rgb_dir, comp, write_alpha, expand_mono, d);
}
stbiw__write_flush(s);
s->func(s->context, &zero, scanline_pad);
}
}
@ -467,16 +491,27 @@ static int stbiw__outfile(stbi__write_context *s, int rgb_dir, int vdir, int x,
static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, const void *data)
{
int pad = (-x*3) & 3;
return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) data,0,pad,
"11 4 22 4" "4 44 22 444444",
'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
if (comp != 4) {
// write RGB bitmap
int pad = (-x*3) & 3;
return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) data,0,pad,
"11 4 22 4" "4 44 22 444444",
'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
} else {
// RGBA bitmaps need a v4 header
// use BI_BITFIELDS mode with 32bpp and alpha mask
// (straight BI_RGB with alpha mask doesn't work in most readers)
return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *)data,1,0,
"11 4 22 4" "4 44 22 444444 4444 4 444 444 444 444",
'B', 'M', 14+108+x*y*4, 0, 0, 14+108, // file header
108, x,y, 1,32, 3,0,0,0,0,0, 0xff0000,0xff00,0xff,0xff000000u, 0, 0,0,0, 0,0,0, 0,0,0, 0,0,0); // bitmap V4 header
}
}
STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)
{
stbi__write_context s;
stbi__write_context s = { 0 };
stbi__start_write_callbacks(&s, func, context);
return stbi_write_bmp_core(&s, x, y, comp, data);
}
@ -484,7 +519,7 @@ STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x,
#ifndef STBI_WRITE_NO_STDIO
STBIWDEF int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data)
{
stbi__write_context s;
stbi__write_context s = { 0 };
if (stbi__start_write_file(&s,filename)) {
int r = stbi_write_bmp_core(&s, x, y, comp, data);
stbi__end_write_file(&s);
@ -557,24 +592,25 @@ static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, v
if (diff) {
unsigned char header = STBIW_UCHAR(len - 1);
s->func(s->context, &header, 1);
stbiw__write1(s, header);
for (k = 0; k < len; ++k) {
stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin + k * comp);
}
} else {
unsigned char header = STBIW_UCHAR(len - 129);
s->func(s->context, &header, 1);
stbiw__write1(s, header);
stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin);
}
}
}
stbiw__write_flush(s);
}
return 1;
}
STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)
{
stbi__write_context s;
stbi__write_context s = { 0 };
stbi__start_write_callbacks(&s, func, context);
return stbi_write_tga_core(&s, x, y, comp, (void *) data);
}
@ -582,7 +618,7 @@ STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x,
#ifndef STBI_WRITE_NO_STDIO
STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)
{
stbi__write_context s;
stbi__write_context s = { 0 };
if (stbi__start_write_file(&s,filename)) {
int r = stbi_write_tga_core(&s, x, y, comp, (void *) data);
stbi__end_write_file(&s);
@ -598,6 +634,8 @@ STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const
#define stbiw__max(a, b) ((a) > (b) ? (a) : (b))
#ifndef STBI_WRITE_NO_STDIO
static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear)
{
int exponent;
@ -732,7 +770,7 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f
char header[] = "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n";
s->func(s->context, header, sizeof(header)-1);
#ifdef __STDC_WANT_SECURE_LIB__
#ifdef __STDC_LIB_EXT1__
len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
#else
len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
@ -748,15 +786,14 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f
STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data)
{
stbi__write_context s;
stbi__write_context s = { 0 };
stbi__start_write_callbacks(&s, func, context);
return stbi_write_hdr_core(&s, x, y, comp, (float *) data);
}
#ifndef STBI_WRITE_NO_STDIO
STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data)
{
stbi__write_context s;
stbi__write_context s = { 0 };
if (stbi__start_write_file(&s,filename)) {
int r = stbi_write_hdr_core(&s, x, y, comp, (float *) data);
stbi__end_write_file(&s);
@ -944,6 +981,23 @@ STBIWDEF unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, i
(void) stbiw__sbfree(hash_table[i]);
STBIW_FREE(hash_table);
// store uncompressed instead if compression was worse
if (stbiw__sbn(out) > data_len + 2 + ((data_len+32766)/32767)*5) {
stbiw__sbn(out) = 2; // truncate to DEFLATE 32K window and FLEVEL = 1
for (j = 0; j < data_len;) {
int blocklen = data_len - j;
if (blocklen > 32767) blocklen = 32767;
stbiw__sbpush(out, data_len - j == blocklen); // BFINAL = ?, BTYPE = 0 -- no compression
stbiw__sbpush(out, STBIW_UCHAR(blocklen)); // LEN
stbiw__sbpush(out, STBIW_UCHAR(blocklen >> 8));
stbiw__sbpush(out, STBIW_UCHAR(~blocklen)); // NLEN
stbiw__sbpush(out, STBIW_UCHAR(~blocklen >> 8));
memcpy(out+stbiw__sbn(out), data+j, blocklen);
stbiw__sbn(out) += blocklen;
j += blocklen;
}
}
{
// compute adler32 on input
unsigned int s1=1, s2=0;
@ -1552,7 +1606,7 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in
STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality)
{
stbi__write_context s;
stbi__write_context s = { 0 };
stbi__start_write_callbacks(&s, func, context);
return stbi_write_jpg_core(&s, x, y, comp, (void *) data, quality);
}
@ -1561,7 +1615,7 @@ STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x,
#ifndef STBI_WRITE_NO_STDIO
STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality)
{
stbi__write_context s;
stbi__write_context s = { 0 };
if (stbi__start_write_file(&s,filename)) {
int r = stbi_write_jpg_core(&s, x, y, comp, data, quality);
stbi__end_write_file(&s);
@ -1574,6 +1628,10 @@ STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const
#endif // STB_IMAGE_WRITE_IMPLEMENTATION
/* Revision history
1.16 (2021-07-11)
make Deflate code emit uncompressed blocks when it would otherwise expand
support writing BMPs with alpha channel
1.15 (2020-07-13) unknown
1.14 (2020-02-02) updated JPEG writer to downsample chroma channels
1.13
1.12
@ -1611,7 +1669,7 @@ STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const
add HDR output
fix monochrome BMP
0.95 (2014-08-17)
add monochrome TGA output
add monochrome TGA output
0.94 (2014-05-31)
rename private functions to avoid conflicts with stb_image.h
0.93 (2014-05-27)

View File

@ -301,7 +301,7 @@ You can get cfg-files by path: `darknet/cfg/`
- OpenImages: use `python ./scripts/get_openimages_dataset.py` for labeling train detection dataset
- Pascal VOC: use `python ./scripts/voc_label.py` for labeling Train/Test/Val detection datasets
- ILSVRC2012 (ImageNet classification): use `./scripts/get_imagenet_train.sh` (also `imagenet_label.sh` for labeling valid set)
- German/Belgium/Russian/LISA/MASTIF Traffic Sign Datasets for Detection - use this parsers: https://github.com/angeligareta/Datasets2Darknet#detection-task
- German/Belgium/Russian/LISA/MASTIF Traffic Sign Datasets for Detection - use this parser: https://github.com/angeligareta/Datasets2Darknet#detection-task
- List of other datasets: https://github.com/AlexeyAB/darknet/tree/master/scripts#datasets
### Improvements in this repository
@ -372,9 +372,9 @@ If you customize build with CMake GUI, darknet executable will be installed in y
- Smart WebCam - preferably: https://play.google.com/store/apps/details?id=com.acontech.android.SmartWebCam2
- IP Webcam: https://play.google.com/store/apps/details?id=com.pas.webcam
2. Connect your Android phone to computer by WiFi (through a WiFi-router) or USB
2. Connect your Android phone to the computer by WiFi (through a WiFi-router) or USB
3. Start Smart WebCam on your phone
4. Replace the address below, on shown in the phone application (Smart WebCam) and launch:
4. Replace the address below, shown in the phone application (Smart WebCam) and launch:
- Yolo v4 COCO-model: `./darknet detector demo data/coco.data yolov4.cfg yolov4.weights http://192.168.0.80:8080/video?dummy=param.mjpg -i 0`
@ -428,7 +428,7 @@ Before make, you can set such options in the `Makefile`: [link](https://github.c
or use in such a way: `LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./uselib data/coco.names cfg/yolov4.cfg yolov4.weights test.mp4`
- `ZED_CAMERA=1` to build a library with ZED-3D-camera support (should be ZED SDK installed), then run
`LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./uselib data/coco.names cfg/yolov4.cfg yolov4.weights zed_camera`
- You also need to specify for which graphics card the code is generated. This is done by setting `ARCH=`. If you use a never version than CUDA 11 you further need to edit line 20 from Makefile and remove `-gencode arch=compute_30,code=sm_30 \` as Kepler GPU support was dropped in CUDA 11. You can also drop the general `ARCH=` and just uncomment `ARCH=` for your graphics card.
- You also need to specify for which graphics card the code is generated. This is done by setting `ARCH=`. If you use a newer version than CUDA 11 you further need to edit line 20 from Makefile and remove `-gencode arch=compute_30,code=sm_30 \` as Kepler GPU support was dropped in CUDA 11. You can also drop the general `ARCH=` and just uncomment `ARCH=` for your graphics card.
### How to compile on Windows (using `CMake`)
@ -611,7 +611,7 @@ If you made you custom model that isn't based on other models, then you can trai
## When should I stop training
Usually sufficient 2000 iterations for each class(object), but not less than number of training images and not less than 6000 iterations in total. But for a more precise definition when you should stop training, use the following manual:
Usually sufficient 2000 iterations for each class(object), but not less than number of training images and not less than 6000 iterations in total. But for a more precise definition of when you should stop training, use the following manual:
1. During training, you will see varying indicators of error, and you should stop when no longer decreases **0.XXXXXXX avg**:

View File

@ -32,7 +32,7 @@ def parser():
def str2int(video_path):
"""
argparse returns and string althout webcam uses int (0, 1 ...)
argparse returns strings although webcam uses int (0, 1 ...)
Cast to int if needed
"""
try:

View File

@ -79,7 +79,7 @@ double WCSS(matrix data, int *assignments, matrix centers)
{
int i, j;
double sum = 0;
for(i = 0; i < data.rows; ++i){
int ci = assignments[i];
sum += (1 - dist(data.vals[i], centers.vals[ci], data.cols));
@ -143,10 +143,10 @@ model do_kmeans(matrix data, int k)
int main(int argc, char *argv[])
{
if(argc < 3){
if(argc < 3){
fprintf(stderr, "usage: %s <csv-file> [points/centers/stats]\n", argv[0]);
return 0;
}
}
int i,j;
srand(time(0));
matrix data = csv_to_matrix(argv[1], 0);
@ -159,7 +159,7 @@ int main(int argc, char *argv[])
int *assignments = m.assignments;
for(i = 0; i < k; ++i){
if(i != 0) printf("-\n");
for(j = 0; j < data.rows; ++j){
for(j = 0; j < data.rows; ++j){
if(!(assignments[j] == i)) continue;
printf("%f, %f\n", data.vals[j][0], data.vals[j][1]);
}
@ -323,7 +323,7 @@ matrix csv_to_matrix(char *filename, int header)
return m;
}
// Arguement parsing
// Argument parsing
void del_arg(int argc, char **argv, int index)
{
@ -389,4 +389,3 @@ char *find_char_arg(int argc, char **argv, char *arg, char *def)
}
return def;
}

View File

@ -1,8 +0,0 @@
root=true
[*]
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

View File

@ -743,4 +743,4 @@ extern "C" void gradient_array_normalize_channels_ongpu(float *output_gpu, int n
gradient_array_normalize_channels_kernel << <num_blocks, BLOCK, 0, get_cuda_stream() >> > (output_gpu, size, batch, channels, wh_step, delta_gpu);
CHECK_CUDA(cudaPeekAtLastError());
}
}

View File

@ -51,7 +51,7 @@ void demo_art(char *cfgfile, char *weightfile, int cam_index)
score = score;
printf("I APPRECIATE THIS ARTWORK: %10.7f%%\n", score*100);
printf("[");
int upper = 30;
int upper = 30;
for(i = 0; i < upper; ++i){
printf("%c", ((i+.5) < score*upper) ? 219 : ' ');
}

View File

@ -888,4 +888,4 @@ void grad_contrastive_loss_negative(size_t i, int *labels, size_t num_of_samples
}
}
}
}
}

View File

@ -512,8 +512,8 @@ __global__ void fill_kernel(int N, float ALPHA, float *X, int INCX)
__global__ void mask_kernel_new_api(int n, float *x, float mask_num, float *mask, float val)
{
int i = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
if (i < n && mask[i] == mask_num) x[i] = val;
int i = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
if (i < n && mask[i] == mask_num) x[i] = val;
}
__global__ void mask_kernel(int n, float *x, float mask_num, float *mask)
@ -804,7 +804,7 @@ extern "C" void reorg_ongpu(float *x, int w, int h, int c, int batch, int stride
extern "C" void mask_gpu_new_api(int N, float * X, float mask_num, float * mask, float val)
{
mask_kernel_new_api <<<cuda_gridsize(N), BLOCK, 0, get_cuda_stream() >>>(N, X, mask_num, mask, val);
mask_kernel_new_api <<<cuda_gridsize(N), BLOCK, 0, get_cuda_stream() >>>(N, X, mask_num, mask, val);
CHECK_CUDA(cudaPeekAtLastError());
}
@ -1250,18 +1250,18 @@ extern "C" void smooth_l1_gpu(int n, float *pred, float *truth, float *delta, fl
__global__ void softmax_x_ent_kernel(int n, float *pred, float *truth, float *delta, float *error)
{
int i = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
if (i < n) {
float t = truth[i];
float p = pred[i];
error[i] = (t) ? -log(p) : 0;
delta[i] = t - p;
}
int i = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
if (i < n) {
float t = truth[i];
float p = pred[i];
error[i] = (t) ? -log(p) : 0;
delta[i] = t - p;
}
}
extern "C" void softmax_x_ent_gpu(int n, float *pred, float *truth, float *delta, float *error)
{
softmax_x_ent_kernel << <cuda_gridsize(n), BLOCK, 0, get_cuda_stream() >> >(n, pred, truth, delta, error);
softmax_x_ent_kernel << <cuda_gridsize(n), BLOCK, 0, get_cuda_stream() >> >(n, pred, truth, delta, error);
CHECK_CUDA(cudaPeekAtLastError());
}
@ -1364,35 +1364,35 @@ extern "C" void softmax_gpu(float *input, int n, int offset, int groups, float t
__device__ void softmax_device_new_api(float *input, int n, float temp, int stride, float *output)
{
int i;
float sum = 0;
float largest = -INFINITY;
for (i = 0; i < n; ++i) {
int val = input[i*stride];
largest = (val>largest) ? val : largest;
}
for (i = 0; i < n; ++i) {
float e = expf(input[i*stride] / temp - largest / temp);
sum += e;
output[i*stride] = e;
}
for (i = 0; i < n; ++i) {
output[i*stride] /= sum;
}
int i;
float sum = 0;
float largest = -INFINITY;
for (i = 0; i < n; ++i) {
int val = input[i*stride];
largest = (val>largest) ? val : largest;
}
for (i = 0; i < n; ++i) {
float e = expf(input[i*stride] / temp - largest / temp);
sum += e;
output[i*stride] = e;
}
for (i = 0; i < n; ++i) {
output[i*stride] /= sum;
}
}
__global__ void softmax_kernel_new_api(float *input, int n, int batch, int batch_offset, int groups, int group_offset, int stride, float temp, float *output)
{
int id = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
if (id >= batch*groups) return;
int b = id / groups;
int g = id % groups;
softmax_device_new_api(input + b*batch_offset + g*group_offset, n, temp, stride, output + b*batch_offset + g*group_offset);
int id = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
if (id >= batch*groups) return;
int b = id / groups;
int g = id % groups;
softmax_device_new_api(input + b*batch_offset + g*group_offset, n, temp, stride, output + b*batch_offset + g*group_offset);
}
extern "C" void softmax_gpu_new_api(float *input, int n, int batch, int batch_offset, int groups, int group_offset, int stride, float temp, float *output)
{
softmax_kernel_new_api << <cuda_gridsize(batch*groups), BLOCK, 0, get_cuda_stream() >> >(input, n, batch, batch_offset, groups, group_offset, stride, temp, output);
softmax_kernel_new_api << <cuda_gridsize(batch*groups), BLOCK, 0, get_cuda_stream() >> >(input, n, batch, batch_offset, groups, group_offset, stride, temp, output);
CHECK_CUDA(cudaPeekAtLastError());
}
@ -1430,34 +1430,34 @@ extern "C" void upsample_gpu(float *in, int w, int h, int c, int batch, int stri
__global__ void softmax_tree_kernel(float *input, int spatial, int batch, int stride, float temp, float *output, int groups, int *group_size, int *group_offset)
{
int id = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
if (id >= spatial*batch*groups) return;
int s = id % spatial;
id = id / spatial;
int g = id % groups;
int b = id / groups;
int goff = group_offset[g] * spatial;
int boff = b*stride;
softmax_device_new_api(input + goff + boff + s, group_size[g], temp, spatial, output + goff + boff + s);
int id = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
if (id >= spatial*batch*groups) return;
int s = id % spatial;
id = id / spatial;
int g = id % groups;
int b = id / groups;
int goff = group_offset[g] * spatial;
int boff = b*stride;
softmax_device_new_api(input + goff + boff + s, group_size[g], temp, spatial, output + goff + boff + s);
}
extern "C" void softmax_tree_gpu(float *input, int spatial, int batch, int stride, float temp, float *output, tree hier)
{
int *tree_groups_size = cuda_make_int_array_new_api(hier.group_size, hier.groups);
int *tree_groups_offset = cuda_make_int_array_new_api(hier.group_offset, hier.groups);
/*
static int *tree_groups_size = 0;
static int *tree_groups_offset = 0;
if(!tree_groups_size){
tree_groups_size = cuda_make_int_array(hier.group_size, hier.groups);
tree_groups_offset = cuda_make_int_array(hier.group_offset, hier.groups);
}
*/
int num = spatial*batch*hier.groups;
softmax_tree_kernel <<<cuda_gridsize(num), BLOCK, 0, get_cuda_stream() >>>(input, spatial, batch, stride, temp, output, hier.groups, tree_groups_size, tree_groups_offset);
int *tree_groups_size = cuda_make_int_array_new_api(hier.group_size, hier.groups);
int *tree_groups_offset = cuda_make_int_array_new_api(hier.group_offset, hier.groups);
/*
static int *tree_groups_size = 0;
static int *tree_groups_offset = 0;
if(!tree_groups_size){
tree_groups_size = cuda_make_int_array(hier.group_size, hier.groups);
tree_groups_offset = cuda_make_int_array(hier.group_offset, hier.groups);
}
*/
int num = spatial*batch*hier.groups;
softmax_tree_kernel <<<cuda_gridsize(num), BLOCK, 0, get_cuda_stream() >>>(input, spatial, batch, stride, temp, output, hier.groups, tree_groups_size, tree_groups_offset);
CHECK_CUDA(cudaPeekAtLastError());
cuda_free((float *)tree_groups_size);
cuda_free((float *)tree_groups_offset);
cuda_free((float *)tree_groups_size);
cuda_free((float *)tree_groups_offset);
}

View File

@ -345,12 +345,12 @@ dxrep dx_box_iou(box pred, box truth, IOU_LOSS iou_loss) {
p_dl += ((giou_C * dU_wrt_l) - (U * dC_wrt_l)) / (giou_C * giou_C);
p_dr += ((giou_C * dU_wrt_r) - (U * dC_wrt_r)) / (giou_C * giou_C);
}
if (Iw<=0||Ih<=0) {
p_dt = ((giou_C * dU_wrt_t) - (U * dC_wrt_t)) / (giou_C * giou_C);
if (Iw<=0||Ih<=0) {
p_dt = ((giou_C * dU_wrt_t) - (U * dC_wrt_t)) / (giou_C * giou_C);
p_db = ((giou_C * dU_wrt_b) - (U * dC_wrt_b)) / (giou_C * giou_C);
p_dl = ((giou_C * dU_wrt_l) - (U * dC_wrt_l)) / (giou_C * giou_C);
p_dr = ((giou_C * dU_wrt_r) - (U * dC_wrt_r)) / (giou_C * giou_C);
}
}
}
float Ct = fmin(pred.y - pred.h / 2,truth.y - truth.h / 2);
@ -418,21 +418,21 @@ dxrep dx_box_iou(box pred, box truth, IOU_LOSS iou_loss) {
p_dw += (2*Cw*dCw_dw+2*Ch*dCh_dw)*S / (C * C);
p_dh += (2*Cw*dCw_dh+2*Ch*dCh_dh)*S / (C * C);
}
if (Iw<=0||Ih<=0){
if (Iw<=0||Ih<=0){
p_dx = (2*(truth.x-pred.x)*C-(2*Cw*dCw_dx+2*Ch*dCh_dx)*S) / (C * C);
p_dy = (2*(truth.y-pred.y)*C-(2*Cw*dCw_dy+2*Ch*dCh_dy)*S) / (C * C);
p_dw = (2*Cw*dCw_dw+2*Ch*dCh_dw)*S / (C * C);
p_dh = (2*Cw*dCw_dh+2*Ch*dCh_dh)*S / (C * C);
}
}
//The following codes are calculating the gradient of ciou.
//The following codes are calculating the gradient of ciou.
if (iou_loss == CIOU) {
float ar_gt = truth.w / truth.h;
float ar_gt = truth.w / truth.h;
float ar_pred = pred.w / pred.h;
float ar_loss = 4 / (M_PI * M_PI) * (atan(ar_gt) - atan(ar_pred)) * (atan(ar_gt) - atan(ar_pred));
float alpha = ar_loss / (1 - I/U + ar_loss + 0.000001);
float ar_dw=8/(M_PI*M_PI)*(atan(ar_gt)-atan(ar_pred))*pred.h;
float alpha = ar_loss / (1 - I/U + ar_loss + 0.000001);
float ar_dw=8/(M_PI*M_PI)*(atan(ar_gt)-atan(ar_pred))*pred.h;
float ar_dh=-8/(M_PI*M_PI)*(atan(ar_gt)-atan(ar_pred))*pred.w;
if (C > 0) {
// dar*
@ -441,7 +441,7 @@ dxrep dx_box_iou(box pred, box truth, IOU_LOSS iou_loss) {
p_dw += (2*Cw*dCw_dw+2*Ch*dCh_dw)*S / (C * C) + alpha * ar_dw;
p_dh += (2*Cw*dCw_dh+2*Ch*dCh_dh)*S / (C * C) + alpha * ar_dh;
}
if (Iw<=0||Ih<=0){
if (Iw<=0||Ih<=0){
p_dx = (2*(truth.x-pred.x)*C-(2*Cw*dCw_dx+2*Ch*dCh_dx)*S) / (C * C);
p_dy = (2*(truth.y-pred.y)*C-(2*Cw*dCw_dy+2*Ch*dCh_dy)*S) / (C * C);
p_dw = (2*Cw*dCw_dw+2*Ch*dCh_dw)*S / (C * C) + alpha * ar_dw;

View File

@ -12,19 +12,19 @@ typedef struct{
} dbox;
//typedef struct detection {
// box bbox;
// int classes;
// float *prob;
// float *mask;
// float objectness;
// int sort_class;
// box bbox;
// int classes;
// float *prob;
// float *mask;
// float objectness;
// int sort_class;
//} detection;
typedef struct detection_with_class {
detection det;
// The most probable class id: the best class index in this->prob.
// Is filled temporary when processing results, otherwise not initialized
int best_class;
detection det;
// The most probable class id: the best class index in this->prob.
// Is filled temporary when processing results, otherwise not initialized
int best_class;
} detection_with_class;
#ifdef __cplusplus

View File

@ -291,7 +291,7 @@ void validate_coco_recall(char *cfgfile, char *weightfile)
if (nms) do_nms(boxes, probs, side*side*l.n, 1, nms_thresh);
char labelpath[4096];
replace_image_to_label(path, labelpath);
replace_image_to_label(path, labelpath);
int num_labels = 0;
box_label *truth = read_boxes(labelpath, &num_labels);
@ -389,16 +389,16 @@ void test_coco(char *cfgfile, char *weightfile, char *filename, float thresh)
void run_coco(int argc, char **argv)
{
int dont_show = find_arg(argc, argv, "-dont_show");
int mjpeg_port = find_int_arg(argc, argv, "-mjpeg_port", -1);
int dont_show = find_arg(argc, argv, "-dont_show");
int mjpeg_port = find_int_arg(argc, argv, "-mjpeg_port", -1);
int json_port = find_int_arg(argc, argv, "-json_port", -1);
char *out_filename = find_char_arg(argc, argv, "-out_filename", 0);
char *out_filename = find_char_arg(argc, argv, "-out_filename", 0);
char *prefix = find_char_arg(argc, argv, "-prefix", 0);
float thresh = find_float_arg(argc, argv, "-thresh", .2);
float hier_thresh = find_float_arg(argc, argv, "-hier", .5);
float hier_thresh = find_float_arg(argc, argv, "-hier", .5);
int cam_index = find_int_arg(argc, argv, "-c", 0);
int frame_skip = find_int_arg(argc, argv, "-s", 0);
int ext_output = find_arg(argc, argv, "-ext_output");
int ext_output = find_arg(argc, argv, "-ext_output");
if(argc < 4){
fprintf(stderr, "usage: %s %s [train/test/valid] [cfg] [weights (optional)]\n", argv[0], argv[1]);
@ -413,5 +413,5 @@ void run_coco(int argc, char **argv)
else if(0==strcmp(argv[2], "valid")) validate_coco(cfg, weights);
else if(0==strcmp(argv[2], "recall")) validate_coco_recall(cfg, weights);
else if(0==strcmp(argv[2], "demo")) demo(cfg, weights, thresh, hier_thresh, cam_index, filename, coco_classes, 80, 1, frame_skip,
prefix, out_filename, mjpeg_port, 0, json_port, dont_show, ext_output, 0, 0, 0, 0, 0);
prefix, out_filename, mjpeg_port, 0, json_port, dont_show, ext_output, 0, 0, 0, 0, 0);
}

View File

@ -92,4 +92,4 @@ void col2im_cpu_ext(const float* data_col, const int channels,
}
}
}
}
}

View File

@ -133,4 +133,4 @@ void col2im_gpu_ext(const float* data_col, const int channels,
height_col, width_col, data_im);
CHECK_CUDA(cudaPeekAtLastError());
}
}

View File

@ -363,12 +363,12 @@ void forward_connected_layer_gpu(connected_layer l, network_state state)
gemm_ongpu(0,1,m,n,k,1,a,k,b,k,1,c,n);
#endif // CUDNN
if (l.batch_normalize) {
forward_batchnorm_layer_gpu(l, state);
}
else {
add_bias_gpu(l.output_gpu, l.biases_gpu, l.batch, l.outputs, 1);
}
if (l.batch_normalize) {
forward_batchnorm_layer_gpu(l, state);
}
else {
add_bias_gpu(l.output_gpu, l.biases_gpu, l.batch, l.outputs, 1);
}
//for(i = 0; i < l.batch; ++i) axpy_ongpu(l.outputs, 1, l.biases_gpu, 1, l.output_gpu + i*l.outputs, 1);
activate_array_ongpu(l.output_gpu, l.outputs*l.batch, l.activation);
}

View File

@ -1688,4 +1688,3 @@ image *visualize_convolutional_layer(convolutional_layer l, char *window, image
free_image(dc);
return single_weights;
}

View File

@ -25,8 +25,8 @@ char *get_cost_string(COST_TYPE a)
return "masked";
case SMOOTH:
return "smooth";
default:
return "sse";
default:
return "sse";
}
}

View File

@ -553,17 +553,17 @@ int *cuda_make_int_array(size_t n)
int *cuda_make_int_array_new_api(int *x, size_t n)
{
int *x_gpu;
size_t size = sizeof(int)*n;
cudaError_t status = cudaMalloc((void **)&x_gpu, size);
int *x_gpu;
size_t size = sizeof(int)*n;
cudaError_t status = cudaMalloc((void **)&x_gpu, size);
CHECK_CUDA(status);
if (x) {
//status = cudaMemcpy(x_gpu, x, size, cudaMemcpyHostToDevice);
if (x) {
//status = cudaMemcpy(x_gpu, x, size, cudaMemcpyHostToDevice);
cudaError_t status = cudaMemcpyAsync(x_gpu, x, size, cudaMemcpyHostToDevice, get_cuda_stream());
CHECK_CUDA(status);
}
if (!x_gpu) error("Cuda malloc failed", DARKNET_LOC);
return x_gpu;
}
if (!x_gpu) error("Cuda malloc failed", DARKNET_LOC);
return x_gpu;
}
void cuda_free(float *x_gpu)

View File

@ -68,7 +68,7 @@ extern "C" {
float *cuda_make_array(float *x, size_t n);
void **cuda_make_array_pointers(void **x, size_t n);
int *cuda_make_int_array(size_t n);
int *cuda_make_int_array_new_api(int *x, size_t n);
int *cuda_make_int_array_new_api(int *x, size_t n);
void cuda_push_array(float *x_gpu, float *x, size_t n);
//LIB_API void cuda_pull_array(float *x_gpu, float *x, size_t n);
//LIB_API void cuda_set_device(int n);

View File

@ -117,7 +117,7 @@ void operations(char *cfgfile)
ops += 2l * l.n * l.size*l.size*l.c * l.out_h*l.out_w;
} else if(l.type == CONNECTED){
ops += 2l * l.inputs * l.outputs;
} else if (l.type == RNN){
} else if (l.type == RNN){
ops += 2l * l.input_layer->inputs * l.input_layer->outputs;
ops += 2l * l.self_layer->inputs * l.self_layer->outputs;
ops += 2l * l.output_layer->inputs * l.output_layer->outputs;
@ -251,7 +251,7 @@ void reset_normalize_net(char *cfgfile, char *weightfile, char *outfile)
denormalize_connected_layer(*l.ui);
denormalize_connected_layer(*l.ug);
denormalize_connected_layer(*l.uo);
}
}
}
save_weights(net, outfile);
}
@ -412,7 +412,7 @@ void denormalize_net(char *cfgfile, char *weightfile, char *outfile)
l.ug->batch_normalize = 0;
l.uo->batch_normalize = 0;
net.layers[i].batch_normalize=0;
}
}
}
save_weights(net, outfile);
}
@ -432,7 +432,7 @@ void visualize(char *cfgfile, char *weightfile)
int main(int argc, char **argv)
{
#ifdef _DEBUG
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
printf(" _DEBUG is used \n");
#endif
@ -440,11 +440,11 @@ int main(int argc, char **argv)
printf(" DEBUG=1 \n");
#endif
int i;
for (i = 0; i < argc; ++i) {
if (!argv[i]) continue;
strip_args(argv[i]);
}
int i;
for (i = 0; i < argc; ++i) {
if (!argv[i]) continue;
strip_args(argv[i]);
}
//test_resize("data/bad.jpg");
//test_box();
@ -493,7 +493,7 @@ int main(int argc, char **argv)
run_detector(argc, argv);
} else if (0 == strcmp(argv[1], "detect")){
float thresh = find_float_arg(argc, argv, "-thresh", .24);
int ext_output = find_arg(argc, argv, "-ext_output");
int ext_output = find_arg(argc, argv, "-ext_output");
char *filename = (argc > 4) ? argv[4]: 0;
test_detector("cfg/coco.data", argv[2], argv[3], filename, thresh, 0.5, 0, ext_output, 0, NULL, 0, 0);
} else if (0 == strcmp(argv[1], "cifar")){

View File

@ -45,8 +45,8 @@ typedef struct load_args{
char **labels;
int h;
int w;
int c; // color depth
int out_w;
int c; // color depth
int out_w;
int out_h;
int nh;
int nw;
@ -55,7 +55,7 @@ typedef struct load_args{
int classes;
int background;
int scale;
int small_object;
int small_object;
float jitter;
int flip;
float angle;

View File

@ -287,29 +287,29 @@ void backward_detection_layer_gpu(detection_layer l, network_state state)
void get_detection_detections(layer l, int w, int h, float thresh, detection *dets)
{
int i, j, n;
float *predictions = l.output;
//int per_cell = 5*num+classes;
for (i = 0; i < l.side*l.side; ++i) {
int row = i / l.side;
int col = i % l.side;
for (n = 0; n < l.n; ++n) {
int index = i*l.n + n;
int p_index = l.side*l.side*l.classes + i*l.n + n;
float scale = predictions[p_index];
int box_index = l.side*l.side*(l.classes + l.n) + (i*l.n + n) * 4;
box b;
b.x = (predictions[box_index + 0] + col) / l.side * w;
b.y = (predictions[box_index + 1] + row) / l.side * h;
b.w = pow(predictions[box_index + 2], (l.sqrt ? 2 : 1)) * w;
b.h = pow(predictions[box_index + 3], (l.sqrt ? 2 : 1)) * h;
dets[index].bbox = b;
dets[index].objectness = scale;
for (j = 0; j < l.classes; ++j) {
int class_index = i*l.classes;
float prob = scale*predictions[class_index + j];
dets[index].prob[j] = (prob > thresh) ? prob : 0;
}
}
}
int i, j, n;
float *predictions = l.output;
//int per_cell = 5*num+classes;
for (i = 0; i < l.side*l.side; ++i) {
int row = i / l.side;
int col = i % l.side;
for (n = 0; n < l.n; ++n) {
int index = i*l.n + n;
int p_index = l.side*l.side*l.classes + i*l.n + n;
float scale = predictions[p_index];
int box_index = l.side*l.side*(l.classes + l.n) + (i*l.n + n) * 4;
box b;
b.x = (predictions[box_index + 0] + col) / l.side * w;
b.y = (predictions[box_index + 1] + row) / l.side * h;
b.w = pow(predictions[box_index + 2], (l.sqrt ? 2 : 1)) * w;
b.h = pow(predictions[box_index + 3], (l.sqrt ? 2 : 1)) * h;
dets[index].bbox = b;
dets[index].objectness = scale;
for (j = 0; j < l.classes; ++j) {
int class_index = i*l.classes;
float prob = scale*predictions[class_index + j];
dets[index].prob[j] = (prob > thresh) ? prob : 0;
}
}
}
}

View File

@ -51,7 +51,7 @@ layer make_gaussian_yolo_layer(int batch, int w, int h, int n, int total, int *m
l.outputs = h*w*n*(classes + 8 + 1);
l.inputs = l.outputs;
l.max_boxes = max_boxes;
l.truth_size = 4 + 2;
l.truth_size = 4 + 2;
l.truths = l.max_boxes*l.truth_size;
l.delta = (float*)calloc(batch*l.outputs, sizeof(float));
l.output = (float*)calloc(batch*l.outputs, sizeof(float));

View File

@ -64,8 +64,8 @@ permute_args(int panonopt_start, int panonopt_end, int opt_end,
char* swap;
/*
* compute lengths of blocks and number and size of cycles
*/
* compute lengths of blocks and number and size of cycles
*/
nnonopts = panonopt_end - panonopt_start;
nopts = opt_end - panonopt_end;
ncycle = gcd(nnonopts, nopts);
@ -91,7 +91,7 @@ permute_args(int panonopt_start, int panonopt_end, int opt_end,
#ifdef REPLACE_GETOPT
/*
* getopt --
* Parse argc/argv argument vector.
* Parse argc/argv argument vector.
*
* [eventually this will replace the BSD getopt]
*/
@ -99,13 +99,13 @@ int getopt(int nargc, char* const* nargv, const char* options)
{
/*
* We don't pass FLAG_PERMUTE to getopt_internal() since
* the BSD getopt(3) (unlike GNU) has never done this.
*
* Furthermore, since many privileged programs call getopt()
* before dropping privileges it makes sense to keep things
* as simple (and bug-free) as possible.
*/
* We don't pass FLAG_PERMUTE to getopt_internal() since
* the BSD getopt(3) (unlike GNU) has never done this.
*
* Furthermore, since many privileged programs call getopt()
* before dropping privileges it makes sense to keep things
* as simple (and bug-free) as possible.
*/
return (getopt_internal(nargc, nargv, options, NULL, NULL, 0));
}
#endif /* REPLACE_GETOPT */
@ -129,24 +129,24 @@ int getopt(int nargc, char* const* nargv, const char* options)
extern "C" {
#endif
struct option /* specification for a long form option... */
struct option /* specification for a long form option... */
{
const char* name; /* option name, without leading hyphens */
int has_arg; /* does it take an argument? */
int* flag; /* where to save its status, or NULL */
int val; /* its associated status value */
int has_arg; /* does it take an argument? */
int* flag; /* where to save its status, or NULL */
int val; /* its associated status value */
};
enum /* permitted values for its `has_arg' field... */
enum /* permitted values for its `has_arg' field... */
{
no_argument = 0, /* option never takes an argument */
required_argument, /* option always requires an argument */
optional_argument /* option may take an argument */
no_argument = 0, /* option never takes an argument */
required_argument, /* option always requires an argument */
optional_argument /* option may take an argument */
};
/*
* parse_long_options --
* Parse long options in argc/argv argument vector.
* Parse long options in argc/argv argument vector.
* Returns -1 if short_too is set and the option does not match long_options.
*/
static int
@ -186,9 +186,9 @@ parse_long_options(char* const* nargv, const char* options,
break;
}
/*
* If this is a known short option, don't allow
* a partial match of a single character.
*/
* If this is a known short option, don't allow
* a partial match of a single character.
*/
if (short_too && current_argv_len == 1)
continue;
@ -212,8 +212,8 @@ parse_long_options(char* const* nargv, const char* options,
warnx(noarg, (int)current_argv_len,
current_argv);
/*
* XXX: GNU sets optopt to val regardless of flag
*/
* XXX: GNU sets optopt to val regardless of flag
*/
if (long_options[match].flag == NULL)
optopt = long_options[match].val;
else
@ -225,23 +225,23 @@ parse_long_options(char* const* nargv, const char* options,
optarg = has_equal;
else if (long_options[match].has_arg == required_argument) {
/*
* optional argument doesn't use next nargv
*/
* optional argument doesn't use next nargv
*/
optarg = nargv[optind++];
}
}
if ((long_options[match].has_arg == required_argument)
&& (optarg == NULL)) {
/*
* Missing argument; leading ':' indicates no error
* should be generated.
*/
* Missing argument; leading ':' indicates no error
* should be generated.
*/
if (PRINT_ERROR)
warnx(recargstring,
current_argv);
/*
* XXX: GNU sets optopt to val regardless of flag
*/
* XXX: GNU sets optopt to val regardless of flag
*/
if (long_options[match].flag == NULL)
optopt = long_options[match].val;
else
@ -271,7 +271,7 @@ parse_long_options(char* const* nargv, const char* options,
/*
* getopt_internal --
* Parse argc/argv argument vector. Called by user level routines.
* Parse argc/argv argument vector. Called by user level routines.
*/
static int
getopt_internal(int nargc, char* const* nargv, const char* options,
@ -285,19 +285,19 @@ getopt_internal(int nargc, char* const* nargv, const char* options,
return (-1);
/*
* XXX Some GNU programs (like cvs) set optind to 0 instead of
* XXX using optreset. Work around this braindamage.
*/
* XXX Some GNU programs (like cvs) set optind to 0 instead of
* XXX using optreset. Work around this braindamage.
*/
if (optind == 0)
optind = optreset = 1;
/*
* Disable GNU extensions if POSIXLY_CORRECT is set or options
* string begins with a '+'.
*
* CV, 2009-12-14: Check POSIXLY_CORRECT anew if optind == 0 or
* optreset != 0 for GNU compatibility.
*/
* Disable GNU extensions if POSIXLY_CORRECT is set or options
* string begins with a '+'.
*
* CV, 2009-12-14: Check POSIXLY_CORRECT anew if optind == 0 or
* optreset != 0 for GNU compatibility.
*/
if (posixly_correct == -1 || optreset != 0)
posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
if (*options == '-')
@ -322,9 +322,9 @@ start:
optind -= nonopt_end - nonopt_start;
} else if (nonopt_start != -1) {
/*
* If we skipped non-options, set optind
* to the first of them.
*/
* If we skipped non-options, set optind
* to the first of them.
*/
optind = nonopt_start;
}
nonopt_start = nonopt_end = -1;
@ -334,17 +334,17 @@ start:
place = EMSG; /* found non-option */
if (flags & FLAG_ALLARGS) {
/*
* GNU extension:
* return non-option as argument to option 1
*/
* GNU extension:
* return non-option as argument to option 1
*/
optarg = nargv[optind++];
return (INORDER);
}
if (!(flags & FLAG_PERMUTE)) {
/*
* If no permutation wanted, stop parsing
* at first non-option.
*/
* If no permutation wanted, stop parsing
* at first non-option.
*/
return (-1);
}
/* do permutation */
@ -364,15 +364,15 @@ start:
nonopt_end = optind;
/*
* If we have "-" do nothing, if "--" we are done.
*/
* If we have "-" do nothing, if "--" we are done.
*/
if (place[1] != '\0' && *++place == '-' && place[1] == '\0') {
optind++;
place = EMSG;
/*
* We found an option (--), so if we skipped
* non-options, we have to permute.
*/
* We found an option (--), so if we skipped
* non-options, we have to permute.
*/
if (nonopt_end != -1) {
permute_args(nonopt_start, nonopt_end,
optind, nargv);
@ -384,11 +384,11 @@ start:
}
/*
* Check long options if:
* 1) we were passed some
* 2) the arg is not just "-"
* 3) either the arg starts with -- we are getopt_long_only()
*/
* Check long options if:
* 1) we were passed some
* 2) the arg is not just "-"
* 3) either the arg starts with -- we are getopt_long_only()
*/
if (long_options != NULL && place != nargv[optind] && (*place == '-' || (flags & FLAG_LONGONLY))) {
short_too = 0;
if (*place == '-')
@ -406,10 +406,10 @@ start:
if ((optchar = (int)*place++) == (int)':' || (optchar == (int)'-' && *place != '\0') || (oli = (char*)strchr(options, optchar)) == NULL) {
/*
* If the user specified "-" and '-' isn't listed in
* options, return -1 (non-option) as per POSIX.
* Otherwise, it is an unknown option character (or ':').
*/
* If the user specified "-" and '-' isn't listed in
* options, return -1 (non-option) as per POSIX.
* Otherwise, it is an unknown option character (or ':').
*/
if (optchar == (int)'-' && *place == '\0')
return (-1);
if (!*place)
@ -462,7 +462,7 @@ start:
/*
* getopt_long --
* Parse argc/argv argument vector.
* Parse argc/argv argument vector.
*/
int getopt_long(int nargc, char* const* nargv, const char* options,
const struct option* long_options, int* idx)
@ -474,7 +474,7 @@ int getopt_long(int nargc, char* const* nargv, const char* options,
/*
* getopt_long_only --
* Parse argc/argv argument vector.
* Parse argc/argv argument vector.
*/
int getopt_long_only(int nargc, char* const* nargv, const char* options,
const struct option* long_options, int* idx)

View File

@ -75,12 +75,12 @@ extern "C" {
#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
//extern int optind; /* index of first non-option in argv */
//extern int optopt; /* single option character, as parsed */
//extern int opterr; /* flag to enable built-in diagnostics... */
// /* (user may set to zero, to suppress) */
//extern int optind; /* index of first non-option in argv */
//extern int optopt; /* single option character, as parsed */
//extern int opterr; /* flag to enable built-in diagnostics... */
// /* (user may set to zero, to suppress) */
//
//extern char *optarg; /* pointer to argument of current option */
//extern char *optarg; /* pointer to argument of current option */
#define PRINT_ERROR ((opterr) && (*options != ':'))
@ -145,7 +145,7 @@ static void permute_args(int panonopt_start, int panonopt_end, int opt_end, char
#ifdef REPLACE_GETOPT
/*
* getopt --
* Parse argc/argv argument vector.
* Parse argc/argv argument vector.
*
* [eventually this will replace the BSD getopt]
*/
@ -187,26 +187,26 @@ extern "C" {
/*
* parse_long_options --
* Parse long options in argc/argv argument vector.
* Parse long options in argc/argv argument vector.
* Returns -1 if short_too is set and the option does not match long_options.
*/
/* static int parse_long_options(char* const* nargv, const char* options, const struct option* long_options, int* idx, int short_too); */
/*
* getopt_internal --
* Parse argc/argv argument vector. Called by user level routines.
* Parse argc/argv argument vector. Called by user level routines.
*/
/* static int getopt_internal(int nargc, char* const* nargv, const char* options, const struct option* long_options, int* idx, int flags); */
/*
* getopt_long --
* Parse argc/argv argument vector.
* Parse argc/argv argument vector.
*/
int getopt_long(int nargc, char* const* nargv, const char* options, const struct option* long_options, int* idx);
/*
* getopt_long_only --
* Parse argc/argv argument vector.
* Parse argc/argv argument vector.
*/
int getopt_long_only(int nargc, char* const* nargv, const char* options, const struct option* long_options, int* idx);

View File

@ -580,9 +580,9 @@ void engine_go(char *filename, char *weightfile, int multi)
fprintf(f, "final_status_list dead\n");
fclose(f);
#ifdef _WIN32
FILE *p = _popen("./gnugo --mode gtp < game.txt", "r");
FILE *p = _popen("./gnugo --mode gtp < game.txt", "r");
#else
FILE *p = popen("./gnugo --mode gtp < game.txt", "r");
FILE *p = popen("./gnugo --mode gtp < game.txt", "r");
#endif
for(i = 0; i < count; ++i){
free(fgetl(p));
@ -721,9 +721,9 @@ float score_game(float *board)
fprintf(f, "final_score\n");
fclose(f);
#ifdef _WIN32
FILE *p = _popen("./gnugo --mode gtp < game.txt", "r");
FILE *p = _popen("./gnugo --mode gtp < game.txt", "r");
#else
FILE *p = popen("./gnugo --mode gtp < game.txt", "r");
FILE *p = popen("./gnugo --mode gtp < game.txt", "r");
#endif
for(i = 0; i < count; ++i){
free(fgetl(p));
@ -740,9 +740,9 @@ float score_game(float *board)
}
if(player == 'W') score = -score;
#ifdef _WIN32
_pclose(p);
_pclose(p);
#else
pclose(p);
pclose(p);
#endif
return score;
}

View File

@ -500,7 +500,7 @@ __device__ void transpose8rS32_reversed_diagonale(unsigned char* A, unsigned cha
B[7 * n] = reverse_byte_CUDA(x >> 24); B[6 * n] = reverse_byte_CUDA(x >> 16); B[5 * n] = reverse_byte_CUDA(x >> 8); B[4 * n] = reverse_byte_CUDA(x);
B[3 * n] = reverse_byte_CUDA(y >> 24); B[2 * n] = reverse_byte_CUDA(y >> 16); B[1 * n] = reverse_byte_CUDA(y >> 8); B[0 * n] = reverse_byte_CUDA(y);
//__device__ unsigned int __brev(unsigned int x)
//__device__ unsigned int __brev(unsigned int x)
//Reverse the bit order of a 32 bit unsigned integer.
// https://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH__INTRINSIC__INT.html
}
@ -1750,8 +1750,8 @@ __global__ void gemm_nn_custom_bin_mean_transposed_gpu_kernel(int M, int N, int
// https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#wmma-subbyte
// nvcuda::wmma::col_major -> cutlass::MatrixLayout::kColumnMajor (matrix is not transposed)
// Matrix A Matrix B Accumulator Matrix Size (m-n-k)
// precision::b1 precision::b1 int 8x8x128
// Matrix A Matrix B Accumulator Matrix Size (m-n-k)
// precision::b1 precision::b1 int 8x8x128
// The only dimensions currently supported by WMMA for XNOR
// const int WMMA_M = 8;
@ -2285,4 +2285,4 @@ void im2col_gpu_ext(const float* data_im, const int channels,
width_col, data_col);
CHECK_CUDA(cudaPeekAtLastError());
}
}

View File

@ -705,7 +705,7 @@ void show_image(image p, const char *name)
#ifdef OPENCV
show_image_cv(p, name);
#else
fprintf(stderr, "Not compiled with OpenCV, saving to %s.png instead\n", name);
fprintf(stderr, "Not compiled with OpenCV, saving to %s.jpg instead\n", name);
save_image(p, name);
#endif // OPENCV
}

View File

@ -1147,12 +1147,12 @@ extern "C" void draw_train_loss(char *windows_name, mat_cv* img_src, int img_siz
if (iteration_old == 0)
cv::putText(img, accuracy_name, cv::Point(10, 12), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.7, CV_RGB(255, 0, 0), 1, CV_AA);
if (iteration_old != 0){
cv::line(img,
if (iteration_old != 0){
cv::line(img,
cv::Point(img_offset + draw_size * (float)iteration_old / max_batches, draw_size * (1 - old_precision)),
cv::Point(img_offset + draw_size * (float)current_batch / max_batches, draw_size * (1 - precision)),
CV_RGB(255, 0, 0), 1, 8, 0);
}
}
sprintf(char_buff, "%2.1f%% ", precision * 100);
cv::putText(img, char_buff, cv::Point(10, 28), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.7, CV_RGB(255, 255, 255), 5, CV_AA);
@ -1434,9 +1434,9 @@ extern "C" void cv_draw_object(image sized, float *truth_cpu, int max_boxes, int
while (!selected) {
#ifndef CV_VERSION_EPOCH
int pressed_key = cv::waitKeyEx(20); // OpenCV 3.x
int pressed_key = cv::waitKeyEx(20); // OpenCV 3.x
#else
int pressed_key = cv::waitKey(20); // OpenCV 2.x
int pressed_key = cv::waitKey(20); // OpenCV 2.x
#endif
if (pressed_key == 27 || pressed_key == 1048603) break;// break; // ESC - save & exit

View File

@ -36,10 +36,10 @@ extern "C" {
// NETWORK,
// XNOR,
// REGION,
// YOLO,
// YOLO,
// REORG,
// UPSAMPLE,
// REORG_OLD,
// UPSAMPLE,
// REORG_OLD,
// BLANK
//} LAYER_TYPE;
@ -48,15 +48,15 @@ extern "C" {
//} COST_TYPE;
//typedef struct {
// int batch;
// float learning_rate;
// float momentum;
// float decay;
// int adam;
// float B1;
// float B2;
// float eps;
// int t;
// int batch;
// float learning_rate;
// float momentum;
// float decay;
// int adam;
// float B1;
// float B2;
// float eps;
// int t;
//} update_args;
/*
@ -87,7 +87,7 @@ struct layer{
int side;
int stride;
int reverse;
int spatial;
int spatial;
int pad;
int sqrt;
int flip;
@ -105,8 +105,8 @@ struct layer{
float shift;
float ratio;
float learning_rate_scale;
int focal_loss;
int noloss;
int focal_loss;
int noloss;
int softmax;
int classes;
int coords;
@ -118,10 +118,10 @@ struct layer{
int noadjust;
int reorg;
int log;
int tanh;
int *mask;
int total;
float bflops;
int tanh;
int *mask;
int total;
float bflops;
int adam;
float B1;
@ -146,14 +146,14 @@ struct layer{
float coord_scale;
float object_scale;
float noobject_scale;
float mask_scale;
float mask_scale;
float class_scale;
int bias_match;
int random;
float ignore_thresh;
float truth_thresh;
float ignore_thresh;
float truth_thresh;
float thresh;
float focus;
float focus;
int classfix;
int absolute;
@ -208,7 +208,7 @@ struct layer{
int * input_sizes;
float * delta;
float * output;
float * loss;
float * loss;
float * squared;
float * norms;
@ -298,8 +298,8 @@ struct layer{
float * weights_gpu;
float * weight_updates_gpu;
float * weights_gpu16;
float * weight_updates_gpu16;
float * weights_gpu16;
float * weight_updates_gpu16;
float * biases_gpu;
float * bias_updates_gpu;
@ -308,7 +308,7 @@ struct layer{
float * scale_updates_gpu;
float * output_gpu;
float * loss_gpu;
float * loss_gpu;
float * delta_gpu;
float * rand_gpu;
float * squared_gpu;
@ -318,7 +318,7 @@ struct layer{
cudnnTensorDescriptor_t srcTensorDesc16, dstTensorDesc16;
cudnnTensorDescriptor_t dsrcTensorDesc, ddstTensorDesc;
cudnnTensorDescriptor_t dsrcTensorDesc16, ddstTensorDesc16;
cudnnTensorDescriptor_t normTensorDesc, normDstTensorDesc, normDstTensorDescF16;
cudnnTensorDescriptor_t normTensorDesc, normDstTensorDesc, normDstTensorDescF16;
cudnnFilterDescriptor_t weightDesc, weightDesc16;
cudnnFilterDescriptor_t dweightDesc, dweightDesc16;
cudnnConvolutionDescriptor_t convDesc;

View File

@ -142,7 +142,7 @@ maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int s
else cudnn_maxpool_setup(&l);
#endif // GPU
l.bflops = (l.size*l.size*l.c * l.out_h*l.out_w) / 1000000000.;
l.bflops = (l.size*l.size*l.c * l.out_h*l.out_w) / 1000000000.;
if (avgpool) {
if (stride_x == stride_y)
fprintf(stderr, "avg %2dx%2d/%2d %4d x%4d x%4d -> %4d x%4d x%4d %5.3f BF\n", size, size, stride_x, w, h, c, l.out_w, l.out_h, l.out_c, l.bflops);
@ -411,4 +411,4 @@ void backward_local_avgpool_layer(const maxpool_layer l, network_state state)
}
}
}
}

View File

@ -889,8 +889,8 @@ void custom_get_region_detections(layer l, int w, int h, int net_w, int net_h, f
dets[j].best_class_idx = -1;
for (i = 0; i < l.classes; ++i) {
if (probs[j][i] > highest_prob) {
highest_prob = probs[j][i];
dets[j].best_class_idx = i;
highest_prob = probs[j][i];
dets[j].best_class_idx = i;
}
dets[j].prob[i] = probs[j][i];
}

View File

@ -23,7 +23,7 @@ typedef struct network{
float *workspace;
int n;
int batch;
uint64_t *seen;
uint64_t *seen;
float epoch;
int subdivisions;
float momentum;
@ -61,7 +61,7 @@ typedef struct network{
float exposure;
float saturation;
float hue;
int small_object;
int small_object;
int gpu_index;
tree *hierarchy;
@ -71,11 +71,11 @@ typedef struct network{
float **input_gpu;
float **truth_gpu;
float **input16_gpu;
float **output16_gpu;
size_t *max_input16_size;
size_t *max_output16_size;
int wait_stream;
float **input16_gpu;
float **output16_gpu;
size_t *max_input16_size;
size_t *max_output16_size;
int wait_stream;
#endif
} network;

View File

@ -26,8 +26,8 @@ float option_find_float_quiet(list *l, char *key, float def);
void option_unused(list *l);
//typedef struct {
// int classes;
// char **names;
// int classes;
// char **names;
//} metadata;
//LIB_API metadata get_metadata(char *file);

View File

@ -362,17 +362,17 @@ connected_layer parse_connected(list *options, size_params params)
softmax_layer parse_softmax(list *options, size_params params)
{
int groups = option_find_int_quiet(options, "groups", 1);
softmax_layer layer = make_softmax_layer(params.batch, params.inputs, groups);
layer.temperature = option_find_float_quiet(options, "temperature", 1);
char *tree_file = option_find_str(options, "tree", 0);
if (tree_file) layer.softmax_tree = read_tree(tree_file);
layer.w = params.w;
layer.h = params.h;
layer.c = params.c;
layer.spatial = option_find_float_quiet(options, "spatial", 0);
layer.noloss = option_find_int_quiet(options, "noloss", 0);
return layer;
int groups = option_find_int_quiet(options, "groups", 1);
softmax_layer layer = make_softmax_layer(params.batch, params.inputs, groups);
layer.temperature = option_find_float_quiet(options, "temperature", 1);
char *tree_file = option_find_str(options, "tree", 0);
if (tree_file) layer.softmax_tree = read_tree(tree_file);
layer.w = params.w;
layer.h = params.h;
layer.c = params.c;
layer.spatial = option_find_float_quiet(options, "spatial", 0);
layer.noloss = option_find_int_quiet(options, "noloss", 0);
return layer;
}
contrastive_layer parse_contrastive(list *options, size_params params)

View File

@ -155,5 +155,3 @@ void push_implicit_layer(layer l)
CHECK_CUDA(cudaPeekAtLastError());
}
#endif

View File

@ -160,7 +160,7 @@ void generate_vid_rnn(char *cfgfile, char *weightfile)
//CvCapture* cap = cvCaptureFromFile("extra/vid/ILSVRC2015/Data/VID/snippets/val/ILSVRC2015_val_00007030.mp4");
float *feat;
float *next;
next = NULL;
next = NULL;
image last;
for(i = 0; i < 25; ++i){
image im = get_image_from_stream_cpp(cap);

View File

@ -14,16 +14,16 @@
void softmax_tree(float *input, int batch, int inputs, float temp, tree *hierarchy, float *output)
{
int b;
for (b = 0; b < batch; ++b) {
int i;
int count = 0;
for (i = 0; i < hierarchy->groups; ++i) {
int group_size = hierarchy->group_size[i];
softmax(input + b*inputs + count, group_size, temp, output + b*inputs + count, 1);
count += group_size;
}
}
int b;
for (b = 0; b < batch; ++b) {
int i;
int count = 0;
for (i = 0; i < hierarchy->groups; ++i) {
int group_size = hierarchy->group_size[i];
softmax(input + b*inputs + count, group_size, temp, output + b*inputs + count, 1);
count += group_size;
}
}
}
softmax_layer make_softmax_layer(int batch, int inputs, int groups)
@ -89,28 +89,28 @@ void pull_softmax_layer_output(const softmax_layer layer)
void forward_softmax_layer_gpu(const softmax_layer l, network_state net)
{
if(l.softmax_tree){
softmax_tree_gpu(net.input, 1, l.batch, l.inputs, l.temperature, l.output_gpu, *l.softmax_tree);
/*
int i;
int count = 0;
for (i = 0; i < l.softmax_tree->groups; ++i) {
int group_size = l.softmax_tree->group_size[i];
softmax_gpu(net.input_gpu + count, group_size, l.batch, l.inputs, 1, 0, 1, l.temperature, l.output_gpu + count);
count += group_size;
}
*/
softmax_tree_gpu(net.input, 1, l.batch, l.inputs, l.temperature, l.output_gpu, *l.softmax_tree);
/*
int i;
int count = 0;
for (i = 0; i < l.softmax_tree->groups; ++i) {
int group_size = l.softmax_tree->group_size[i];
softmax_gpu(net.input_gpu + count, group_size, l.batch, l.inputs, 1, 0, 1, l.temperature, l.output_gpu + count);
count += group_size;
}
*/
} else {
if(l.spatial){
softmax_gpu_new_api(net.input, l.c, l.batch*l.c, l.inputs/l.c, l.w*l.h, 1, l.w*l.h, 1, l.output_gpu);
softmax_gpu_new_api(net.input, l.c, l.batch*l.c, l.inputs/l.c, l.w*l.h, 1, l.w*l.h, 1, l.output_gpu);
}else{
softmax_gpu_new_api(net.input, l.inputs/l.groups, l.batch, l.inputs, l.groups, l.inputs/l.groups, 1, l.temperature, l.output_gpu);
softmax_gpu_new_api(net.input, l.inputs/l.groups, l.batch, l.inputs, l.groups, l.inputs/l.groups, 1, l.temperature, l.output_gpu);
}
}
if(net.truth && !l.noloss){
softmax_x_ent_gpu(l.batch*l.inputs, l.output_gpu, net.truth, l.delta_gpu, l.loss_gpu);
if(l.softmax_tree){
mask_gpu_new_api(l.batch*l.inputs, l.delta_gpu, SECRET_NUM, net.truth, 0);
mask_gpu_new_api(l.batch*l.inputs, l.loss_gpu, SECRET_NUM, net.truth, 0);
mask_gpu_new_api(l.batch*l.inputs, l.delta_gpu, SECRET_NUM, net.truth, 0);
mask_gpu_new_api(l.batch*l.inputs, l.loss_gpu, SECRET_NUM, net.truth, 0);
}
cuda_pull_array(l.loss_gpu, l.loss, l.batch*l.inputs);
l.cost[0] = sum_array(l.loss, l.batch*l.inputs);
@ -119,7 +119,7 @@ void forward_softmax_layer_gpu(const softmax_layer l, network_state net)
void backward_softmax_layer_gpu(const softmax_layer layer, network_state state)
{
axpy_ongpu(layer.batch*layer.inputs, state.net.loss_scale, layer.delta_gpu, 1, state.delta, 1);
axpy_ongpu(layer.batch*layer.inputs, state.net.loss_scale, layer.delta_gpu, 1, state.delta, 1);
}
#endif
@ -620,4 +620,4 @@ void backward_contrastive_layer_gpu(contrastive_layer layer, network_state state
axpy_ongpu(layer.batch*layer.inputs, state.net.loss_scale, layer.delta_gpu, 1, state.delta, 1);
}
#endif
#endif

View File

@ -6,7 +6,7 @@
// int *leaf;
// int n;
// int *parent;
// int *child;
// int *child;
// int *group;
// char **name;
//

View File

@ -251,7 +251,7 @@ void validate_yolo_recall(char *cfgfile, char *weightfile)
if (nms) do_nms(boxes, probs, side*side*l.n, 1, nms);
char labelpath[4096];
replace_image_to_label(path, labelpath);
replace_image_to_label(path, labelpath);
int num_labels = 0;
box_label *truth = read_boxes(labelpath, &num_labels);
@ -343,16 +343,16 @@ void test_yolo(char *cfgfile, char *weightfile, char *filename, float thresh)
void run_yolo(int argc, char **argv)
{
int dont_show = find_arg(argc, argv, "-dont_show");
int mjpeg_port = find_int_arg(argc, argv, "-mjpeg_port", -1);
int dont_show = find_arg(argc, argv, "-dont_show");
int mjpeg_port = find_int_arg(argc, argv, "-mjpeg_port", -1);
int json_port = find_int_arg(argc, argv, "-json_port", -1);
char *out_filename = find_char_arg(argc, argv, "-out_filename", 0);
char *out_filename = find_char_arg(argc, argv, "-out_filename", 0);
char *prefix = find_char_arg(argc, argv, "-prefix", 0);
float thresh = find_float_arg(argc, argv, "-thresh", .2);
float hier_thresh = find_float_arg(argc, argv, "-hier", .5);
float hier_thresh = find_float_arg(argc, argv, "-hier", .5);
int cam_index = find_int_arg(argc, argv, "-c", 0);
int frame_skip = find_int_arg(argc, argv, "-s", 0);
int ext_output = find_arg(argc, argv, "-ext_output");
int ext_output = find_arg(argc, argv, "-ext_output");
if(argc < 4){
fprintf(stderr, "usage: %s %s [train/test/valid] [cfg] [weights (optional)]\n", argv[0], argv[1]);
return;
@ -366,5 +366,5 @@ void run_yolo(int argc, char **argv)
else if(0==strcmp(argv[2], "valid")) validate_yolo(cfg, weights);
else if(0==strcmp(argv[2], "recall")) validate_yolo_recall(cfg, weights);
else if(0==strcmp(argv[2], "demo")) demo(cfg, weights, thresh, hier_thresh, cam_index, filename, voc_names, 20, 1, frame_skip,
prefix, out_filename, mjpeg_port, 0, json_port, dont_show, ext_output, 0, 0, 0, 0, 0);
prefix, out_filename, mjpeg_port, 0, json_port, dont_show, ext_output, 0, 0, 0, 0, 0);
}

View File

@ -69,7 +69,7 @@ int get_device_count() {
return count;
#else
return -1;
#endif // GPU
#endif // GPU
}
bool built_with_cuda(){
@ -106,7 +106,7 @@ int get_device_name(int gpu, char* deviceName) {
return 1;
#else
return -1;
#endif // GPU
#endif // GPU
}
#ifdef GPU