Code Monkey home page Code Monkey logo

Comments (1)

mengxianghan123 avatar mengxianghan123 commented on August 18, 2024

After adding a pre-processing step, the ACC can reach 0.457 for now. But there is still a gap between 0.627 which is reported in the paper. Could you please leave more details? It would be very helpful!

mean = [0.485, 0.456, 0.406]
std = [0.229, 0.224, 0.225]
@torch.no_grad()
def CIFAR10_features():
    transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize(mean, std)])
    cifar10 = torchvision.datasets.CIFAR10(root='/home/mxh/datasets/CIFAR10',train=True,download=False,transform=transform)
    trainloader = torch.utils.data.DataLoader(cifar10, batch_size=2048, shuffle=True, num_workers=2)
    model = torchvision.models.resnet50(weights='DEFAULT')
    model.eval()
    model.fc= torch.nn.Identity()
    img_list = []
    label_list = []
    for img,label in trainloader:
        img_list.append(model(img))
        label_list.append(label)
    cifar10 = torchvision.datasets.CIFAR10(root='/home/mxh/datasets/CIFAR10',train=False,download=False,transform=transform)
    testloader = torch.utils.data.DataLoader(cifar10, batch_size=2048, shuffle=True, num_workers=2)
    for img,label in testloader:
        img_list.append(model(img))
        label_list.append(label)
    img_list = torch.cat(img_list, dim=0).numpy()
    label_list = torch.cat(label_list, dim=0).numpy()
    data = {'data':img_list, 'label':label_list}
    np.save("/home/mxh/codes/EDESC-pytorch-master/data/CIFAR10/cifar.npy", data)

from edesc-pytorch.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.