小编tid*_*idy的帖子

android ndk开发问题:memcpy函数的'无效参数'错误

我在android项目中使用了c ++代码,所以我使用了NDK工具.IDE是eclipse.编译项目时,我得到了memcpy函数的错误:

Invalid arguments '
Candidates are:
void * memcpy(void *, const void *, ?)
'
Run Code Online (Sandbox Code Playgroud)

它发生了malloc,strftime太.

我是在Windows系统下开发的.

为什么?

这是我的代码的一部分:

#include <vector>
#include <iostream>
#include <fstream>
#include <iterator>
#include "dirent.h"

#include <jni.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <android/log.h>

string getCurrentDate() {
    time_t rawtime;
    struct tm * timeinfo;
    char buffer[80];

    time(&rawtime);
    timeinfo = localtime(&rawtime);

    // #######################error part
    strftime(buffer, 80, "%Y-%m-%d_%H-%M-%S", timeinfo);

    string timeStr(buffer);

    return timeStr;
}

std::string jstring2str(JNIEnv* env, jstring jstr) {
    char* …
Run Code Online (Sandbox Code Playgroud)

c++ eclipse android android-ndk

3
推荐指数
1
解决办法
7485
查看次数

为什么高斯滤波器会选择这样的值?

高斯滤波器是图像处理领域着名的图像去噪工具.我看到很多开源软件选择这样的模板:

在此输入图像描述

这些价值来自哪里?

image-processing gaussian probability-density

3
推荐指数
1
解决办法
729
查看次数

为什么使用 tensorflow2.0 的同一数据集的训练准确度和验证准确度不同?

我正在使用 tensorflow2.0 和 tensorflow_datasets 进行训练。但我不明白:为什么训练准确度和损失与验证准确度和损失不同?

这是我的代码:

import tensorflow as tf
import tensorflow_datasets as tfds

data_name = 'uc_merced'
dataset = tfds.load(data_name)
# the train_data and the test_data are same dataset
train_data, test_data = dataset['train'], dataset['train'] 

def parse(img_dict):
    img = tf.image.resize_with_pad(img_dict['image'], 256, 256)
    #img = img / 255.
    label = img_dict['label']
    return img, label

train_data = train_data.map(parse)
train_data = train_data.batch(96)

test_data = test_data.map(parse)
test_data = test_data.batch(96)

strategy = tf.distribute.MirroredStrategy()
with strategy.scope():
    model = tf.keras.applications.ResNet50(weights=None, classes=21, 
            input_shape=(256, 256, 3))
    model.compile(optimizer='adam',
            loss='sparse_categorical_crossentropy',
            metrics=['accuracy'])

model.fit(train_data, …
Run Code Online (Sandbox Code Playgroud)

keras tensorflow tensorflow-datasets tf.keras tensorflow2.0

3
推荐指数
1
解决办法
1827
查看次数

ctype为什么要指定argtypes

我想用python调用c ++库.

我的C++库代码:

#include <stdio.h>

extern "C" {

int test_i(int i)
{
    return i+1;
}

}
Run Code Online (Sandbox Code Playgroud)

我的python代码:

from ctypes import *
libc = cdll.LoadLibrary("cpp/libtest.so")
libc.test_f.argtypes = [c_int] # still works when comment
print libc.test_i(1)
Run Code Online (Sandbox Code Playgroud)

我的问题是:如果我没有指定argtypes,它仍然有效!我必须指定argtypes何时调用C/C++函数?

c++ python ctypes

2
推荐指数
1
解决办法
1833
查看次数

如何计算OpenCV人脸检测器的detection_score?

我想用FDDB来评估一些面部检测器,包括OpenCV.但是FDDB的检测输出文件需要:

<left_x top_y width height detection_score>
Run Code Online (Sandbox Code Playgroud)

它包括detection_score一部分.但opencv的探测器没有这样的输出.怎么输出这个?

opencv confidential-information face-detection viola-jones

2
推荐指数
1
解决办法
1216
查看次数

`control_flow_ops.with_dependencies` 对 tensoflow 意味着什么?

我正在阅读tensorflow模型的代码:https : //github.com/tensorflow/models/blob/master/slim/train_image_classifier.py

我对这个代码部分很困惑:

train_tensor = control_flow_ops.with_dependencies([update_op], total_loss,
                                                  name='train_op')
Run Code Online (Sandbox Code Playgroud)

control_flow_ops.with_dependencies 是什么意思?

python computer-vision deep-learning conv-neural-network tensorflow

2
推荐指数
1
解决办法
1507
查看次数

收集adaboost算法的负样本用于人脸检测

Viola-Jones的AdaBoost方法非常适合人脸检测?我们需要大量的正面和负面样本来训练面部检测器.

收集正样本的规则很简单:包含面部的图像.但收集阴性样本的规则不是很清楚:不包含面部的图像.

但是有很多场景不包含面孔(可能是天空,河流,家畜等).我该收集哪个?怎么知道我收集了足够的阴性样本?

对阴性样本提出了一些建议:使用阳性样本并使用左侧部分作为阴性样本裁剪面部区域.这有用吗?

image-processing computer-vision face-detection adaboost

1
推荐指数
1
解决办法
2932
查看次数

为什么我在Linux上得到错误"没有用于调用A :: A(A)的匹配函数"但在Windows上没有

我编译时,以下代码在Linux上引发错误g++ test.cpp:

#include <iostream>

using namespace std;

class A
{
public:
    A(){
        cout << "call A()" << endl;
    };
    A& operator = (const A& a) {
        cout << "call operator =" << endl;
        return *this;
    }
    A(A& a) {
        cout << "call A(A& a)" << endl;
    }
};

A operator - (A& a1, A& a2)
{
    cout << "call operate -" << endl;
    return a1;
}

int main()
{
    A a1;
    A a2;
    A a3 = a1 - …
Run Code Online (Sandbox Code Playgroud)

c++ linux compiler-errors

1
推荐指数
1
解决办法
763
查看次数

为什么ssd和yolo没有roi池层?

我们知道对象检测框架就像faster-rcnnmask-rcnn有一个roi pooling layeror roi align layer。但是,为什么ssd和yolo框架没有这样的层?

object-detection computer-vision yolo faster-rcnn

1
推荐指数
1
解决办法
340
查看次数