小编Wur*_*rmD的帖子

tf.metrics.auc 的产量与 sklearn.metrics.roc_auc_score 非常不同

tf.metrics.auc与相比产生非常不同的值sklearn.metrics.roc_auc_score与某些情况

我无法确定这种情况的特殊性,但获得一个可重现的示例:

代码和数据可从https://www.dropbox.com/s/ym2ptqaqw2qjite/minimal_program_AUC.zip?raw=1下载

代码:

import sklearn.metrics
from keras.models import Model, load_model
import tensorflow as tf
from keras import backend as K
import numpy as np

def auc(y_true, y_pred):
    auc = tf.metrics.auc(y_true, y_pred, num_thresholds=65)[1]
    K.get_session().run(tf.local_variables_initializer())
    return auc

model = load_model('Model.hdf5', custom_objects={'auc': auc})

X = np.fromfile('X_test(65, 80, 1292, 1).txt', sep=',').reshape(65, 80, 1292, 1)
Y = np.fromfile('Y_test(65, 1).txt', sep=',').reshape(65, 1)
batchsize = 45

evaluation = model.evaluate(X, Y, batch_size=batchsize, verbose=1)

predictions = model.predict(X, batch_size=batchsize, verbose=0, steps=None)

auc = …
Run Code Online (Sandbox Code Playgroud)

python scikit-learn tensorflow

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

CMake 生成的 VS 项目需要 lib 而不是 dll

这是我的最小示例:https://www.dropbox.com/s/7fwsr3sigb60rtw/leveling-test.zip ?dl=0

\n\n

我当前的项目文件夹结构和相关的CMakeLists内容:

\n\n
leveling\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 CMakeLists.txt: add_subdirectory(deps) \n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 deps\n    \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 CMakeLists.txt: add_subdirectory(xml-reading)\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 xml-reading\n        \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 CMakeLists.txt: add_subdirectory(deps)\n        \xe2\x94\x82                   add_library(xml-reading ...)\n        \xe2\x94\x82                   target_include_directories(xml-reading PUBLIC ${CMAKE_CURRENT_LIST_DIR}/deps/tinyxml2)\n        \xe2\x94\x82                   target_link_libraries(xml-reading PUBLIC tinyxml2)\n        \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 deps\n            \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 CMakeLists.txt: add_subdirectory(tinyxml2)\n            \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 tinyxml2\n
Run Code Online (Sandbox Code Playgroud)\n\n

这会生成一个 xml-reading.dll 文件。

\n\n

但是调平项目链接器选项有/DYNAMICBASE "bin\\windows-32\\debug\\xml-reading.lib" "bin\\windows-32\\debug\\BOBPrimitives.lib" "bin\\windows-32\\debug\\tinyxml2d.lib"

\n\n

其结果是:\n2>LINK : fatal error LNK1104: cannot open file \'bin\\windows-32\\debug\\xml-reading.lib\'

\n\n

这是怎么回事?

\n\n
    \n
  • 我尝试将 SHARED 添加到add_library(xml-reading SHARED ...),但没有帮助
  • \n
  • 作为解决方法,我将 STATIC 设置add_library(xml-reading STATIC ...)为强制它生成 .lib 文件 - …

dll cmake visual-studio

5
推荐指数
0
解决办法
2954
查看次数

ffmpeg:考虑增加probesize误差,但永远无法满足

今天,我尝试使用Arch 解决方案通过 FFMPEG 进行流式传输,但由于 FFMPEG 上的一件简单的事情,我所有的尝试都徒劳无功。它说探针大小不够大,所以我本能地越来越大地增加探针大小......现在它-probesize "500M"仍然说它不够大。这是代码片段

[x11grab @ 0x5631f846cd00] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1603397505.341400, bitrate: 1007124 kb/s
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1366x768, 1007124 kb/s, 30 fps, 1000k tbr, 1000k tbn, 1000k tbc
0: Input/output error
Run Code Online (Sandbox Code Playgroud)

和代码

#!/bin/bash
     INRES="1366x768" # input resolution
     OUTRES="1366x768" # output resolution
     FPS="30" # target FPS
     GOP="60" # i-frame interval, should be double …
Run Code Online (Sandbox Code Playgroud)

streaming ffmpeg twitch

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

CERAL 无法序列化 - 无法从输入流读取异常

我发现了一个特定的 100MB bin 文件(最小示例中的 CarveObj_k5_rgbThreshold10_triangleCameraMatches.bin),其中谷物无法加载并抛出异常“无法从输入流读取 368 字节!读取 288”

根据相同数据构建的相应 900MB XML 文件(在最小示例中为 CarveObj_k5_rgbThreshold10_triangleCameraMatches.xml)可以正常加载。

XML 文件是由

    // {
        // std::ofstream outFile(base + "_triangleCameraMatches.xml");
        // cereal::XMLOutputArchive  oarchive(outFile);
        // oarchive(m_triangleCameraMatches);
    // }
Run Code Online (Sandbox Code Playgroud)

二进制版本是由

    // { 
        // std::ofstream outFile(base + "_triangleCameraMatches.bin");
        // cereal::BinaryOutputArchive  oarchive(outFile);
        // oarchive(m_triangleCameraMatches);
    // }
Run Code Online (Sandbox Code Playgroud)

最小示例:https://www.dropbox.com/sh/fu9e8km0mwbhxvu/AAAfrbqn_9Tnokj4BVXB8miea?dl= 0

使用的谷物版本:1.3.0

2017年MSVS

Windows 10

这是一个错误吗?我错过了一些明显的东西吗?同时创建了一个错误报告:https ://github.com/USCiLab/cereal/issues/607

cereal

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

ORB 演示代码出现 cv2.error 错误:来自 OpenCV 代码的未知 C++ 异常

ORB 演示代码位于https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_feature2d/py_orb/py_orb.html

import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread('simple.jpg',0)

# Initiate STAR detector
orb = cv2.ORB()

# find the keypoints with ORB
kp = orb.detect(img,None)

# compute the descriptors with ORB
kp, des = orb.compute(img, kp)

# draw only keypoints location,not size and orientation
img2 = cv2.drawKeypoints(img,kp,color=(0,255,0), flags=0)
plt.imshow(img2),plt.show()
Run Code Online (Sandbox Code Playgroud)

kp = orb.detect(img,None)

  • 在Python3.6中出现错误[WinError 10054] An existing connection was forcibly closed by the remote host
  • 在Python3.8中出现错误cv2.error: Unknown C++ exception …

python opencv orb visual-studio-code

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

错误 C2676 二进制“<<”:“std::ostream”未定义此运算符或转换为预定义运算符可接受的类型

我不明白编译错误 C2676

对于下面的代码

#ifndef __VEC_3D_H__
#define __VEC_3D_H__

#include <vector>
#include <cmath>

namespace Internal
{
    /** very simple 3D vector/ point */
    class Vec3D
    {
    public:
        float mX;
        float mY;
        float mZ;

        /// null constructor
        Vec3D(void) {}

        /// construct from data
        Vec3D(float x, float y, float z) : mX(x), mY(y), mZ(z) {}

        inline friend std::ostream& operator<< (std::ostream& os, const Vec3D& v) 
        {
            os << "(" << v.mX << ", " << v.mY << ", " << v.mZ << ")";
            return os; …
Run Code Online (Sandbox Code Playgroud)

c++ operator-overloading

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

如何添加 git 子模块并将其标记为发布?

git clone my-new-repo-url
mkdir deps
cd deps
git submodule add -b 6.2.0 https://github.com/leethomason/tinyxml2.git
Run Code Online (Sandbox Code Playgroud)

产量

fatal: 'origin/6.2.0' is not a commit and a branch '6.2.0' cannot be created from it
Unable to checkout submodule 'deps/tinyxml2'
Run Code Online (Sandbox Code Playgroud)

不填充 .gitmodules,而是创建一个文件夹.git/modules/deps/tinyxml2并在其中添加一个 repodeps/tinyxml2

我以为我以前这样做过,它会填充 .gitmodules

[submodule "deps/tinyxml2"]
    path = deps/tinyxml2
    url = https://github.com/leethomason/tinyxml2.git
    branch = 6.2.0
Run Code Online (Sandbox Code Playgroud)

但它现在不起作用怎么办?

git git-submodules

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

向量的有效组合最小和均值计算

我需要向量中值的最小值和均值。

我用以下内容分别计算它们:

template <class T>
T Minimum(std::vector<T> & v){ return *min_element(begin(v), end(v)); }

template <class T>
T Mean(std::vector<T> & v)
{
    T sum = std::accumulate(v.begin(), v.end(), static_cast<T>(0));
    T mean = sum / v.size();
    return mean;
}
Run Code Online (Sandbox Code Playgroud)

这两个都必须扫描向量。

是否有一种std 有效的方法来计算向量的最小值和均值,将其仅扫描一次?

c++

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

如何使用 cv2.resize (v4.2.0)

我\xe2\x80\x99m很困惑,请帮我理解:

\n\n

我有这个错误:

\n\n
    img_array = cv2.resize(img_array, dsize=(299, 299, 3), interpolation=cv2.INTER_CUBIC)                                                                                                              \nTypeError: function takes exactly 2 arguments (3 given) \n
Run Code Online (Sandbox Code Playgroud)\n\n

什么时候

\n\n
print(img_array): <class \'numpy.ndarray\'>\nimg_array.shape: (240, 320, 3)\nprint(cv2.__version__): 4.2.0 \n
Run Code Online (Sandbox Code Playgroud)\n\n

VSCode 中将鼠标悬停在调整大小上会显示

\n\n
def resize(src, dsize, dst=None, fx=None, fy=None, interpolation=None)\nresize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) -> dst . @brief Resizes an image. .\n. The function resize resizes the image src down to or up to the specified size. Note that the . initial dst type or size are …
Run Code Online (Sandbox Code Playgroud)

python opencv

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