【论文阅读】Stealing Image-to-Image Translation Models With a Single Query(2024)

摘要

Training deep neural networks(训练深度神经网络) requires(需要) significant computational resources(大量计算资源) and large datasets(大型数据集) that are often confidential(机密的) or expensive(昂贵的) to collect. As a result(因此), owners(所有者) tend to(倾向于) protect(保护) their models by allowing(允许) access(通过) only via an API. Many works demonstrated(展示) the possibility(可能性) of stealing(窃取) such protected models by repeatedly querying(反复查询) the API. However, to date(到目前为止), research has predominantly(主要) focused on(集中) stealing classification models(窃取分类模型), for which a very large number of queries(大量的查询) has been found necessary. In this paper, we study the possibility of stealing image-to-image models(窃取图像到图像模型的可能性). Surprisingly(令人惊讶的是), we find(发现) that many such models can be stolen with as little as a single, small-sized, query image using simple distillation(使用简单蒸馏). We study this phenomenon(现象) on a wide variety(各种各样) of model architectures(模型架构), datasets(数据集), and tasks(任务), including denoising(去噪), deblurring(去模糊), deraining(去训练), super-resolution(超分辨), and biological image-to-image translation(生物图像到图像的转换). Remarkably(值得注意的是), we find(发现) that the vulnerability to stealing attacks(窃取攻击) is shared by CNNs and by models with attention mechanisms(注意力机制), and that stealing is commonly possible even without knowing the architecture of the target model(即使不知道目标模型的体系架构).

论文链接

Stealing Image-to-Image Translation Models With a Single Query

  • 12
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
如果要使用Work-Stealing Queue来实现函数一个函数顺序执行,可以将每个函数封装成一个任务,并将这些任务添加到共享的任务队列中。然后,每个线程维护自己的任务队列,并从中取出任务执行,如果自己的队列为空,就从其他线程的队列中“偷”任务执行。 下面是一个使用Work-Stealing Queue实现函数一个函数顺序执行的简单代码示例: ```c++ #include <iostream> #include <thread> #include <vector> #include <deque> #include <atomic> #include <random> std::deque<std::function<void()>> task_queue; std::vector<std::thread> threads; std::atomic<bool> stop_flag{false}; std::vector<std::deque<std::function<void()>>> thread_queues; void worker(int id) { std::default_random_engine engine(id); std::uniform_int_distribution<int> distribution(0, threads.size() - 1); while (!stop_flag) { std::function<void()> task; bool found = false; // 从自己的任务队列中取出任务执行 if (!thread_queues[id].empty()) { task = thread_queues[id].front(); thread_queues[id].pop_front(); found = true; } else { // 从其他线程的任务队列中“偷”任务执行 for (int i = 0; i < threads.size(); ++i) { int index = (id + i) % threads.size(); if (!thread_queues[index].empty()) { task = thread_queues[index].back(); thread_queues[index].pop_back(); found = true; break; } } } // 如果没有找到任务并且任务队列为空,则等待一段时间再继续查找任务 if (!found && task_queue.empty()) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); continue; } // 如果找到了任务,则执行任务 if (found) { task(); } else { // 否则,从任务队列中取出任务并执行 std::lock_guard<std::mutex> lock{task_queue_mutex}; if (!task_queue.empty()) { task = task_queue.front(); task_queue.pop_front(); task(); } } } } void func1() { std::cout << "Function 1" << std::endl; } void func2() { std::cout << "Function 2" << std::endl; } void func3() { std::cout << "Function 3" << std::endl; } int main() { // 创建多个线程 for (int i = 0; i < std::thread::hardware_concurrency(); ++i) { thread_queues.emplace_back(); threads.emplace_back(worker, i); } // 将函数封装成任务并添加到共享的任务队列中 task_queue.emplace_back([]() { func1(); }); task_queue.emplace_back([]() { func2(); }); task_queue.emplace_back([]() { func3(); }); // 等待任务执行完成 while (!task_queue.empty()) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); } // 设置停止标志,等待线程结束 stop_flag = true; for (auto& thread : threads) { thread.join(); } return 0; } ``` 在上面的示例中,我们首先创建多个线程,并将每个线程维护自己的任务队列。然后,我们将函数封装成任务并添加到共享的任务队列中。每个线程循环执行以下操作: 1. 从自己的任务队列中取出任务执行。 2. 如果自己的队列为空,则从其他线程的队列中“偷”任务执行。 3. 如果任务队列为空,则等待一段时间再继续查找任务。 最后,我们等待任务执行完成,设置停止标志,等待线程结束。 这样,我们就可以使用Work-Stealing Queue实现函数一个函数顺序执行的效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Bosenya12

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值