Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
Convert old model to new convention
Browse files Browse the repository at this point in the history
  • Loading branch information
Tran Quang Dat committed May 2, 2018
1 parent ec3bc5d commit 100795d
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 147 deletions.
128 changes: 110 additions & 18 deletions src/LearningCurve.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/constant.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152
os.environ["CUDA_VISIBLE_DEVICES"] = "2"
os.environ["CUDA_VISIBLE_DEVICES"] = "3"
current_dir = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(current_dir, os.path.pardir))

Expand Down
29 changes: 0 additions & 29 deletions src/models/densenet161.py

This file was deleted.

29 changes: 0 additions & 29 deletions src/models/densenet201.py

This file was deleted.

22 changes: 0 additions & 22 deletions src/models/resnet101.py

This file was deleted.

22 changes: 0 additions & 22 deletions src/models/resnet152.py

This file was deleted.

22 changes: 0 additions & 22 deletions src/models/resnet50.py

This file was deleted.

3 changes: 2 additions & 1 deletion src/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import argparse
import sys
import importlib
from models.densenet121 import DenseNet121


def main(args):
Expand All @@ -15,7 +16,7 @@ def main(args):
architect = network.architect
model_name = '%s/%s/%s/%s/model.path.tar' % (args.models_base_dir, architect, args.model_variant, args.model_name)
net = network.build(args.model_variant)
parallel_net = torch.nn.DataParallel(net, device_ids=[0, 1, 2, 3]).cuda()
parallel_net = torch.nn.DataParallel(net, device_ids=[0]).cuda()

checkpoint = torch.load(model_name)
print('Best loss', checkpoint['best_loss'])
Expand Down
1 change: 1 addition & 0 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_dataloader(image_list_file='test_list.csv', percentage=PERCENTAGE, agum
# base on https://github.com/arnoweng/CheXNet/blob/master/model.py
transform = transforms.Compose([
transforms.Resize(256),
# transforms.Resize(586),
transforms.TenCrop(WIDTH),
transforms.Lambda(lambda crops: torch.stack([transforms.ToTensor()(crop) for crop in crops])),
transforms.Lambda(lambda crops: torch.stack([normalize(crop) for crop in crops]))
Expand Down
13 changes: 10 additions & 3 deletions stats/test.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,23 @@ Our Improved Model,0.8311,0.922,0.8891,0.7146,0.8627,0.7883,0.782,0.8844,0.8148,
Microsoft,0.828543,0.8914489999999999,0.817697,0.907302,0.8958149999999999,0.907841,0.817601,0.8818379999999999,0.7218180000000001,0.868002,0.7872020000000001,0.826822,0.793416,0.8890889999999999,0.8453167857142858
20180420-092017,0.8004066158649771,0.8988142277571575,0.8747553554078176,0.6939790118010565,0.8193978759287115,0.7332869650920992,0.7438201809906554,0.8413871791721219,0.8027900893184353,0.8791767004682074,0.8698034001367109,0.8026570327654273,0.7578271478249666,0.8958903556063128,0.8152851527239041
20180422-075022,0.798653881175583,0.9007557982908612,0.8746744822299135,0.7002604371543734,0.8189629509922141,0.7378757522856596,0.7479430086875365,0.85153706290794,0.8042095737887672,0.8864813079898751,0.8786238780226315,0.8052912987242828,0.7548896011355765,0.8764544002586073,0.8169009595459873
20180422-075022,0.8057927223337887,0.9081210906544341,0.8792463354191342,0.702163858816797,0.8355125161087146,0.7548112375882408,0.7585572812446115,0.8572245815797336,0.8076161370287612,0.8904013630575768,0.8923645499419498,0.8191259198403145,0.7617045725810391,0.8934871791599941,0.8261520960967921
20180422-075022,0.8057927223337887,0.908121090654434,0.8792463354191342,0.702163858816797,0.8355125161087146,0.7548112375882408,0.7585572812446115,0.8572245815797336,0.8076161370287612,0.8904013630575768,0.8923645499419498,0.8191259198403145,0.7617045725810391,0.8934871791599941,0.8261520960967921
20180424-071856,0.7850268606397577,0.8717905288252632,0.8673815224550109,0.687021288748239,0.7892487434166635,0.7141985874373309,0.7309027448027289,0.8262544003480353,0.7947842144218532,0.8791545986149505,0.8461498894735126,0.7763139351129741,0.7327885123349145,0.8572779028989113,0.7970209806807247
20180427-091900,0.7822007430707231,0.8827675206069976,0.8650585359065286,0.6831698847683841,0.771609172540391,0.7018607120755895,0.7212616163726566,0.8099643360138112,0.7954257898734811,0.8787417008090816,0.8086111191761216,0.7805237291703744,0.7402710580843954,0.8508573810480826,0.7908802356797586
20180428-111638,0.7925649154495858,0.8934634774946407,0.8715273937547309,0.6906528413990796,0.7926010549913189,0.7166045878995932,0.7352362714241608,0.8284632649240119,0.7978624239582743,0.8806174444099905,0.8491293731622976,0.7853901184299488,0.7449195602002278,0.879184025894758,0.8041583395280442
20180426-065637,0.765048968170689,0.8365458122262288,0.8471098937511328,0.6747942184695437,0.6912942083214202,0.6485350689115145,0.6927382145468102,0.7837295195377517,0.7795525874865441,0.8674223631169551,0.7787135878220492,0.7468025716103055,0.704072237786922,0.8621182830686649,0.762748395344752
20180429-131732,0.791556170307482,0.8910014734280485,0.8726608175966455,0.6915431483204594,0.8112963009004305,0.7370105194840699,0.7311632554482851,0.8374276403464935,0.7978568285406392,0.8816671724802237,0.8623317056350049,0.7904532609601711,0.7484474227707727,0.8845294984592024,0.809210372476995
20180429-200210,0.8266223442365769,0.9166234577482832,0.8859209834916495,0.7103814175134975,0.8606194448242854,0.7894564797131844,0.7802133692052209,0.8868024235127613,0.8121882500900618,0.8969856260982202,0.9270669456801832,0.8420951119328355,0.7864278015800273,0.9289946428305592,0.8464570213183817
20180429-200046,0.8277693053234406,0.9143795034190484,0.8859044508958472,0.714327221981261,0.8585622531896291,0.7936169464915467,0.7674626859001361,0.8843674753532325,0.8155750347451108,0.9004445111531889,0.928063601747634,0.8436329039556167,0.7807675939812142,0.9525946862153374,0.8476762981680174
20180429-200046,0.8277693053234406,0.9143795034190484,0.8859044508958472,0.714327221981261,0.8585622531896291,0.7936169464915467,0.7674626859001361,0.8843674753532325,0.8155750347451108,0.9004445111531889,0.9280636017476339,0.8436329039556167,0.7807675939812142,0.9525946862153374,0.8476762981680174
20180429-195702,0.8239092214027823,0.9143167541617776,0.8847059207321814,0.7112134543933264,0.8566425502115369,0.7884142949098252,0.7706929061778078,0.8859799826326507,0.8163972205468406,0.8924694807493957,0.9274090813451292,0.837232978151125,0.783030722670453,0.9444419632888216,0.8454897522409751
20180430-113040,0.8219204727670816,0.91216448609066,0.8849468611741323,0.7106429667963737,0.8533547149327266,0.7827977907982829,0.7714403613109477,0.8809672298836806,0.8128545913467012,0.8966685029897979,0.9226091007728432,0.8344879446066948,0.7847467951724442,0.9239788095131759,0.8423986162968244
20180430-113040,0.8219204727670816,0.9121644860906601,0.8849468611741323,0.7106429667963737,0.8533547149327266,0.7827977907982829,0.7714403613109477,0.8809672298836806,0.8128545913467012,0.8966685029897979,0.9226091007728432,0.8344879446066948,0.7847467951724442,0.923978809513176,0.8423986162968244
20180430-214452,0.8238339294334716,0.9141128583922256,0.8845404102585791,0.7107366807852067,0.859325091472637,0.7911326951841999,0.7723982360505766,0.8828070899123441,0.8129584228356876,0.8962863938352322,0.9250421800045808,0.8359072716354127,0.7825893356629527,0.9367996495190456,0.8448907317844395
20180501-055454,0.8098019242038129,0.90165988298443,0.8798359457233402,0.7082468790722267,0.8274608314790182,0.7726368795096754,0.7655633230804983,0.8709321733761218,0.805905179955443,0.8944643654349007,0.9039603323357812,0.8247664305877742,0.7750514752685775,0.90702471869012,0.83195073869298
20180501-055908,0.7802428834480728,0.8226256994222507,0.8544353282677903,0.6820214679244977,0.7280348404045929,0.716554651505033,0.7168642190211132,0.8099957424868833,0.786427871758088,0.8694065817339728,0.804720334113668,0.7688966371962309,0.7416498431035572,0.7114040292549515,0.7709485806886216
20180501-133136,0.8260645146770302,0.9146820837974656,0.8869891903024665,0.7124416836197613,0.8621476490599971,0.7965456725400956,0.7725756961257838,0.8862264804236999,0.8165067204371705,0.8952483764484408,0.929977831974648,0.8452255165461742,0.7875728021721012,0.9328195214488814,0.847501695683837
20180501-131748,0.8328056184967374,0.9040708541337684,0.8861124737586558,0.7084991812125523,0.8518789702025037,0.8081883615714502,0.7746623882588095,0.8828905967126628,0.8070068933599033,0.8900481732433425,0.9275941285290248,0.8455158903298271,0.7872375238477696,0.9026990010867462,0.8435150039102682
20180501-132749,0.8288948443842081,0.9130918855145306,0.8866739731145303,0.7098471084178379,0.8621746246824874,0.7984404507163467,0.7679859417357421,0.8900522620920944,0.8170784504799701,0.8959521170496555,0.9342381737375302,0.8361341887344483,0.7853264060059776,0.9361063437478068,0.8472854836009404
20180501-212759,0.8246291976331087,0.9166146508349821,0.8866611954107433,0.7094779641348169,0.8634669683295417,0.7862546567951308,0.776242025003808,0.8839883605029443,0.8160618360793697,0.8943817858737271,0.9206031086493116,0.843968898965193,0.7870307688810984,0.9128742202968456,0.8444468312421872
20180501-214826,0.8234613720090207,0.911570412608606,0.8852945162007074,0.7072919382628635,0.8607713536292779,0.7848256557679997,0.7786903409207291,0.8794178367083676,0.8127681543081894,0.8949344421646181,0.920328539849575,0.8379754338772586,0.7803174796914888,0.9077988392445092,0.8418175939459437
20180501-055454,0.8098019242038129,0.90165988298443,0.8798359457233402,0.7082468790722267,0.8274608314790182,0.7726368795096754,0.7655633230804983,0.8709321733761218,0.805905179955443,0.8944643654349007,0.9039603323357812,0.8247664305877742,0.7750514752685775,0.90702471869012,0.83195073869298
20180502-053438,0.8235019448102534,0.9124618766808822,0.8837603337488255,0.710048122212213,0.8602358605886569,0.7894673084372091,0.7715936138208068,0.8837257722722662,0.8122049876871618,0.8957902567113762,0.9292762208723186,0.8316216299431443,0.7873602708747487,0.9376567115614054,0.8449074935872335

0 comments on commit 100795d

Please sign in to comment.