标签: threshold

如何计算roc曲线?

我写了一个分类器(高斯混合模型)来分类五个人类行为.对于每次观察,分类器计算属于群集的后验概率.

我想要用阈值参数化我的系统的性能,值为0到100.对于每个阈值,对于每个观察,如果属于一个簇的概率大于阈值,我接受分类器的结果否则我丢弃它.

对于每个阈值,我计算真阳性,真阴性,假阳性,假阴性的数量.

比我计算两个函数:灵敏度和特异性为

sensitivity = TP/(TP+FN);

specificity=TN/(TN+FP);
Run Code Online (Sandbox Code Playgroud)

在matlab中:

plot(1-specificity,sensitivity);
Run Code Online (Sandbox Code Playgroud)

有ROC曲线.但结果并不是我所期望的.

这是丢弃,错误,纠正,敏感性和特异性功能的图,改变了一个动作的阈值.

这是丢弃,错误,纠正,敏感性和特异性功能改变阈值的图

这是一个动作的ROC曲线图 这是ROC曲线的图

这是同一动作的ROC曲线的主干 在此输入图像描述

我错了,但我不知道在哪里.也许我错误地计算了FP,FN,TP,TN,特别是当分类器的结果小于阈值时,所以我丢弃了.当丢弃时我必须增加什么?

matlab classification false-positive threshold roc

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

Java中内存不足的通知

Java中是否有任何已交付的功能通知应用程序中的内存不足(或通知它已达到预定义级别)?

我想知道是否有可能在某处注册一个听众(或类似的东西)?我知道Runtime类中的内存方法.我可以自己创建一个计划任务来检查剩余内存,但我想知道是否已经有一个现有的解决方案.

我不这么认为,但我正在寻找确认.

对于记录

MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
NotificationEmitter emitter = (NotificationEmitter) mbean;
NotificationListener listener = new NotificationListener() {

    @Override
    public void handleNotification(Notification notif, Object handback) {

        String notifType = notif.getType();
        if (notifType.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED) ||
            notifType.equals(MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED)) {

            // Retrieve the memory notification information
            CompositeData cd = (CompositeData) notif.getUserData();
            MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
            MemoryUsage mu = info.getUsage();

            System.out.println("Maximum memory = " + mu.getMax());
            System.out.println("Used memory    = " + mu.getUsed());

        }
    }

};

emitter.addNotificationListener(listener, null, null);
Run Code Online (Sandbox Code Playgroud)

java memory listener threshold

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

openCV AdaptiveThreshold与Otsu阈值.投资回报率

我试图使用这两种方法,但似乎自适应阈值似乎给出了更好的结果.我用了

 cvSmooth( temp, dst,CV_GAUSSIAN,9,9, 0);
Run Code Online (Sandbox Code Playgroud)

在原始图像上然后我只使用了阈值.

有没有什么我可以用Otsu方法调整,以使图像更好像自适应阈值?还有一件事,侧面有一些不需要的指纹残留,任何想法我怎么能把它们丢弃?

我从期刊上读到,通过比较自定义方块中白色像素的百分比,我可以获得投资回报率.然而,这种方法要求我有一个阈值,可以使用OTSU方法找到,但我不太确定AdaptiveThresholding.

cvAdaptiveThreshold( temp, dst, 255,CV_ADAPTIVE_THRESH_MEAN_C,CV_THRESH_BINARY,13, 1 );
Run Code Online (Sandbox Code Playgroud)

结果:

原版的自适应

cvThreshold(temp, dst, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
Run Code Online (Sandbox Code Playgroud)

原版的 大津

c++ opencv roi threshold adaptive-threshold

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

即使达到阈值,Hashmap容量也不会增加

Java doc说 - 当哈希表中的条目数超过加载因子和当前容量的乘积时,哈希表被重新哈希

在以下程序中 -

HashMap<Integer, String> map = new HashMap<Integer, String>();
int i = 1;
while(i<16) {
    map.put(i, new Integer(i).toString());
    i++;
}
Run Code Online (Sandbox Code Playgroud)

键是Integer类型,在插入第13到第15个元素时,HashMap容量保持为16,阈值保持与12相同,为什么?

在地图中添加第13个元素后调试屏幕截图 -

args                 String[0] (id=16)
map HashMap<K,V> (id=19)
 entrySet   null
 hashSeed   0
 KeySet     null
 loadFactor 0.75
 modCount   13
 size       13
 table      HashMap$Entry<K,V>[16] (id=25)
 threshold  12
 values     null
i   14

[null, 1=1, 2=2, 3=3, 4=4, 5=5, 6=6, 7=7, 8=8, 9=9, 10=10, 11=11, 12=12, 13=13, null, null] 
Run Code Online (Sandbox Code Playgroud)

具有String类型的键的HashMap - HashMap<String, String>或自定义类 - Map<Employee,Integer>显示第13次插入时的预期行为

java hashmap load-factor threshold

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

用于C++中图像分析的OpenCV二进制图像掩码

我试图分析一些图像外部有很多噪点的图像,但是内部有一个形状清晰的圆形中心.中心是我感兴趣的部分,但外部噪声正在影响我对图像的二进制阈值处理.

为了忽略噪声,我试图设置一个已知中心位置和半径的圆形掩模,这个圆圈外的所有像素都变为黑色.我认为圆圈内的所有内容现在都可以通过二进制阈值分析来轻松分析.

我只是想知道是否有人能够指出我正确的方向来解决这类问题吗?我已经看过这个解决方案了:如何在Open CV中消除圆圈外的所有内容,但是我的一些约束是不同的,我对加载源图像的方法感到困惑.

先感谢您!

c++ opencv mask image-processing threshold

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

检测叶子中的静脉图案?

我的目标是检测叶子中的静脉图案,这些图案表征了不同种类的植物

我已经做了以下事情:

原始图片:

在此输入图像描述

自适应阈值处理后:

在此输入图像描述

然而,静脉不是那么清晰并且变形,有没有什么方法可以获得更好的输出

编辑:

我试过颜色阈值我的结果仍然不能令人满意我得到以下图像

在此输入图像描述

请帮忙

image image-processing filter threshold

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

Android实时黑白阈值图像

我有一个代码,使用以下代码将具有灰色的位图转换为黑色和白色的位图:

// scan through all pixels
for (int x = 0; x < width; ++x) {                                                                                                                                                                                               
  for (int y = 0; y < height; ++y) {                                                                                                                                                                                            
    // get pixel color
    pixel = bitmap.getPixel(x, y);                                                                                                                                                                                              
    A = Color.alpha(pixel);                                                                                                                                                                                                     
    R = Color.red(pixel);                                                                                                                                                                                                       
    G = Color.green(pixel);                                                                                                                                                                                                     
    B = Color.blue(pixel);                                                                                                                                                                                                      
    int gray = (int) (0.2989 * R + 0.5870 * G + 0.1140 * B);                                                                                                                                                                    

    // use 128 as threshold, above -> white, below -> black
    if (gray > 128)
    gray = 255;                                                                                                                                                                                                                 
    else …
Run Code Online (Sandbox Code Playgroud)

android image bitmap image-processing threshold

6
推荐指数
2
解决办法
5505
查看次数

在 scikit-image 中从文件系统加载自定义图像

我是 Python 新手,我正在尝试执行官方页面上显示的教程。我的目标是,使用本地大津阈值方法分析我创建的图片。

带有示例图片的代码工作正常,但我想读取一个自定义图像,该图像与*.py-file存储在同一目录中。

这是代码:

from skimage import data
from skimage.morphology import disk
from skimage.filters import threshold_otsu, rank
from skimage.util import img_as_ubyte

import matplotlib
import matplotlib.pyplot as plt

matplotlib.rcParams['font.size'] = 9
img = img_as_ubyte(data.page())

radius = 15
selem = disk(radius)

local_otsu = rank.otsu(img, selem)
threshold_global_otsu = threshold_otsu(img)
global_otsu = img >= threshold_global_otsu

fig, ax = plt.subplots(2, 2, figsize=(8, 5), sharex=True, sharey=True,
                       subplot_kw={'adjustable': 'box-forced'})
ax0, ax1, ax2, ax3 = ax.ravel()

fig.colorbar(ax0.imshow(img, cmap=plt.cm.gray),
             ax=ax0, orientation='horizontal')
ax0.set_title('Original')
ax0.axis('off')

fig.colorbar(ax1.imshow(local_otsu, cmap=plt.cm.gray),
             ax=ax1, …
Run Code Online (Sandbox Code Playgroud)

python filesystems image threshold scikit-image

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

按条件删除 90% 的随机行 pandas

我有一个 pandas 数据框,想要删除 90% 满足条件的数据。

条件很简单。如果“Parameter1”列的值大于阈值,则将其删除。

我的问题是如何删除其中的 90%,不是连续删除 90% 的值,而是随机删除

python random dataframe threshold pandas

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

Intersection Observer API 中 rootMargin 和阈值的主要区别是什么?

据我所知,一旦你设置了rootMargin:"0px",这意味着当你选择的元素在屏幕上完全可见并且相对于视口或任何相关元素有 0px 的边距时,就会产生效果。

Threshold 属性中,它的值从 0% 到 100% 也表示为 0 到 1。这意味着如果该值为 1,则一旦元素在视口上 100% 可见,回调就会运行。

请强调它们之间的差异。

javascript viewport threshold intersection-observer

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